DEV Community

Mindy Zwanziger
Mindy Zwanziger

Posted on

Shortcut to a Folder - Command Prompt

Find yourself going to a particular folder quite often? Here's a quick and dirty way to set up a command shortcut for Windows Command Prompt to get to that folder more easily.

Step 1 - Run command prompt as an administrator.

To do this, right-click on the icon - wherever it lives. I have my command prompt pinned to my taskbar. A menu will appear - depending on where it lives, the "Run as Administrator" option may be available on that first menu, or you may need to keep digging by right-clicking on "Command Prompt" again.

Step 2 - Create a file in C:\WINDOWS\system32.

If the command prompt window doesn't already show that you're in the System32 folder, navigate there using the cd command.

cd C:\Windows\System32

There are a number of ways to create a new file through the command line, but here is a simple command to use:

copy con filename.cmd

When you press ENTER, the cursor will hop down to the next line. This is the beginning of the text going into your file. As a note, the filename above is the command you'd like to use. For example, if you want to go to your project's folder you could use go_project_name as the file name (don't forget the .cmd)

Step 3 - Add the directory information to the file.

Let's say my project's name is Listly and it's lives on my Desktop. I'd create the file:

copy con go_listly.cmd

On the next line, I'd type cd /d file_path (the /d is optional and allows you to change directories across different drives).

cd /d C:\Users\Mindy\Desktop

Then type Ctrl + Z to save, and ENTER to finish creating the file.

Step 4 - Use the Shortcut!

And you're all set! Simply type your new shortcut anytime you're in your command prompt and you'll be redirected to your folder.

Command well, my friends!

Top comments (1)

Collapse
 
peteshearer profile image
Pete Shearer

This is fantastic, thank you Mindy! Such a simple solution, explained well, and it works perfectly. I appreciate you!