Reputation: 1369
What is the command to reduce the current path in the windows command prompt?
For example when I work in a subfolder I don't want to see the entire path from the root
I don't want to see: C:\Users\myuser\AppData\Local\conda\conda\pkgs> but just: > or pkgs>
Upvotes: 1
Views: 3550
Reputation: 188
Here are some options:
[Option 1.A] Change the prompt with following command: prompt $p$_$g
C:\Users\david\AppData\Roaming\Notepad++
>cd ..
C:\Users\david\AppData\Roaming
>cd "Notepad++\plugins"
C:\Users\david\AppData\Roaming\Notepad++\plugins
>
[Option 1.B] If you like [Option 1.A], you can make it permanent by creating an environmental variable called PROMPT and set the value to $p$_$g
[Option 2] Set the prompt with command:prompt $n$$$g
C$>cd
C:\Users\david\.VirtualBox
C$>
[Option 3] To include only the last directory in the DOS prompt, a batch file (PromptDir.bat) can be created with the following content:
@ECHO OFF
FOR %%I IN (.) DO Prompt %%~nI%%~xI$G
C:\Users\david\AppData\Roaming\Notepad++>PromptDir
Notepad++>
[Option 4] This method includes most of the above options in one batch file, where the user can select which method to apply by passing 1, 2, or 3. If no argument is passed, then the prompt gets reset.
@ECHO OFF
IF "%~1" equ "1" goto :FullPathAboveShortPrompt
IF "%~1" equ "2" goto :ShortPrompt
IF "%~1" equ "3" goto :LastDirPrompt
prompt
Goto :eof
:FullPathAboveShortPrompt
prompt $p$_$g
Goto :eof
:ShortPrompt
prompt $g
Goto :eof
:LastDirPrompt
FOR %%I IN (.) DO Prompt %%~nI%%~xI$G
Goto :eof
Upvotes: 3
Reputation: 667
while you can't change the command prompt to only show the current directory, you can change it to only be the greater than symbol >
by using the following command at the prompt
prompt = $G
for more information you can use the command prompt /?
or check https://technet.microsoft.com/en-us/library/bb490977.aspx
Upvotes: 4