Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Windows command prompt to show only current folder

Instead of showing

C:\Users\test_user\Documents\Folder\etc

show

\etc

or if possible limit it to a certain number

\Document\Folder\etc
like image 382
Wongesse Avatar asked Jun 09 '17 21:06

Wongesse


People also ask

How do I get the current directory in Windows?

Type CD drive: to display the current directory in the specified drive. Type CD without parameters to display the current drive and directory. Use the /D switch to change the current drive in addition to changing the current directory for a drive.

What is current directory in CMD?

The current directory is the current working directory, and is first in the search order when working with REXX File System (RFS). The current directory can be set using the CD command, CD. The CD command has a similar format to the cd command in operating systems such as DOS.

How do I change Active directory in CMD?

To change current working directory under the current drive, use command " cd new-path " (change directory). It is important to take note that you need to set the current drive first (via " x: " command) before setting the current directory under the current drive.

How do I list only directories in CMD?

You can use the DIR command by itself (just type “dir” at the Command Prompt) to list the files and folders in the current directory.

How to show current folder without full path in PowerShell?

Change the prompt to show current folder without full path and greater than symbol at the end: Show activity on this post. As an additional note, I couldn't do Synetech's command until I first created the $profile. Type $profile and hit enter. This will display the profile path PowerShell relies on, even if it doesn't exist (it didn't for me).

How do I change the default directory in command prompt?

Change Directories Using the Drag-and-Drop Method. If the folder you want to open in Command Prompt is on your desktop or already open in File Explorer, you can quickly change to that directory. Type cd followed by a space, drag and drop the folder into the window, and then press Enter. The directory you switched to will be reflected in ...

How do I open a folder from the command line?

If the folder you want to open in Command Prompt is on your desktop or already open in File Explorer, you can quickly change to that directory. Type cd followed by a space, drag and drop the folder into the window, and then press Enter. The directory you switched to will be reflected in the command line.

How do I set the last folder name in the command prompt?

<# FileName: promptPsShort.ps1 To set the prompt to the last folder name in the path: > function prompt {$l=Get-Location; $p="$l".split ("") [-1]; "PS $p> "} # works at cmd prompt, BUT NOT DIREECTLY from a .ps1 file.


1 Answers

If you check in help prompt /? there are two options that can either show the current drive or full path.

I would suggest to use new line option along with the Drive so that you will get more space to view/type the command using below combination.

prompt $P$_$G

With this you will be able to see the Path in the line above the prompt.

like image 63
Chandre Gowda Avatar answered Jan 03 '23 22:01

Chandre Gowda