Shafi

How to Shorten Directory Path in Windows Command Prompt

December 18, 2020

This is my command prompt when I open it up

command prompt when I open it up

I usually keep my codes inside Documents\Codes. Inside the codes directory I have many more subdirectories.

This is already getting a bit hairy, but I have to dive a little deeper to get to the directory I want to execute my command in.

Do you see how little space remains for me to execute my command. Now my only option to keep my sanity while writing my command is to make the CMD window full screen, but I don't want to do that.

So Here's My Solution

First of all, open Start Menu and write environment

Click on Edit the System Environment Variable option.

It'd open a popup window, there click on Environment Variables...

Clicking this would open another popup window, on there click on the New button under User Variable for Joe-Mama-Name

This action would open up a new window called New User Variable.

Once there type in prompt in Variable Name. After that type $G$S in Variable Value Field.

Then press okay and close every window related to the Environment.

Now open up the CMD, you'll see something like this!

Clean and Cool CMD!

You can find all the variables to tweak the CMD here

Created By Shafi

© 2021