vanna
vanna

Reputation: 1572

Shortcut for command line directory change cd in Windows?

I use Windows Vista and I was wondering if there was a shortcut to open the command line directly in the current directory (the one that has the focus). It is actually quite painful to copy/paste each time the current directory in the command line.

Upvotes: 2

Views: 4581

Answers (3)

eylay
eylay

Reputation: 2168

Imagine that I want to create a shortcut command for "cd C:\wamp64\www". For example I want to do something that whenever I type www in command line and I hit Enter then that cd command gets executed.

My command is : cd C:\wamp64\www

Shortcut command should be : www

So in order to do this, follow these steps.

Step 1:
Create an empty folder

You need to create a folder in somewhere that you like, for example I created a folder called "Aliases" directly in Local Disk (C) and inside this folder now I can create some bat files for different shortcut commands.

Step 2
Create a bat file

Since I want my shortcut command to be www I need to create a file called www.bat and inside this file you need to have following codes:

@ECHO OFF
CD /D "C:\wamp64\www"
CMD

Step 3
Edit Environment Variables

And now you need to go to Edit Environment Variables and add C:\Aliases (The folder you created first) in your Path (Since you only need to do it once I did not consider this as a separate step)

DO NOT FORGET TO RESTART YOUR TERMINAL
So now, just restart your Terminal and type www and hit Enter and there you go... Now current folder just changed

Upvotes: 0

Neil
Neil

Reputation: 55402

Just hold down shift while right-clicking the folder and one of the additional options will be "Open Command Window Here".

Upvotes: 0

nickgroenke
nickgroenke

Reputation: 1502

Hold down shift and right click in the directory. The menu that pops up will have the option to open a command prompt there.

Upvotes: 3

Related Questions