How to change CMD start directory

15

3

I want to change the CMD startup directory when I launch it via Start+R

Currently, it points to my users folder. I need it to point to C:\Windows\System32\

When I navigate manually to C:\Windows\System32\ and run CMD from there, it starts in the desired path. When I run from Win+R, it starts from the users folder.

I suspect I need to change the registry or an environment variable. Anyone knows how to ?

THIS QUESTION IS DIFFERENT FROM THE OTHERS FOR THE REASON EXPLAINED BY @KARAN (READ THE THIRD COMMENT FROM THE ANSWERS BELOW)

DIFFERENT ANSWERS ONLY WORK FOR SHORTCUTS

Edit: Found the right answer hidden on the pit of the provided links, kilometers away from the supposed "right answer"

[HKEY_CURRENT_USER\Software\Microsoft\Command Processor] "Autorun"="cd C:\Windows\System32\"

Lucas BS

Posted 2015-05-17T23:50:00.817

Reputation: 333

Question was closed 2015-05-18T06:50:35.217

It's just a workaround :) Autorun holds any command to execute when the process (cmd.exe) is started. It won't work in many cases such as if %homedrive% is not c: as cd would require /d switch to change into another drive, or %windir% is not c:\windows :) – None – 2015-05-18T22:04:35.863

It won't work if AutoRun is disabled by cmd /d :) – None – 2015-05-18T22:12:18.223

1Alternatively you may use cmd /k "cd /d %windir%\sytstem32" for the same purpose. – None – 2015-05-18T22:15:29.780

Why do you need it to open in system32? That's what mine always does by default. It never opens where I want it. Ah - Chinggis6 solved it for me. A great answer in comments. – SDsolar – 2018-04-23T19:25:57.757

Answers

7

If you hit the Win (Start) button and type CMD search field, instead of clicking Command Prompt (cmd.exe or Command Prompt depending on Windows version), either right click and choose properties, or if not present, choose Open File Location then right click and choose properties of the CommandPrompt shortcut.

You can get to it directly in this folder: %APPDATA%\Microsoft\Windows\Start Menu\Programs\System Tools

In the "Start in:" field, it normally says %HOMEDRIVE%%HOMEPATH%

This makes cmd start in the home folder. You can change this to be whatever you'd prefer.

Paul

Posted 2015-05-17T23:50:00.817

Reputation: 52 173

Win+R (which is what I suppose he means by Start+R) is the Run dialog, and you're confusing it with searching in the Start Menu for the Command Prompt shortcut. If he opens a command prompt window by typing cmd in the Run dialog, what you've suggested obviously won't work for him. – Karan – 2015-05-18T00:57:31.447

1@Karan I am interpreting what the OP wrote as using Start+R (Win+R) and typing cmd - so unless my interpretation is incorrect, then this answer will work for him (try it). In any case, it is a dupe by the look of it, I should have checked. – Paul – 2015-05-18T01:08:36.863

You're asking me to try it? Please try it yourself. Go ahead: press Win+R, type cmd in the text field, right-click it and now where do you see Properties? Let me repeat, you've confused typing cmd in the Run dialog (Win+R) with searching for the Command Prompt shortcut in the Start Menu (Win). Only the shortcut has a Properties dialog you can edit. – Karan – 2015-05-18T01:12:39.887

@Karan Crap, sorry, you are right, I instinctively hit the win button and typed it, missed what you were saying. – Paul – 2015-05-18T01:16:08.933

dont see properties in windows 10 – Kalpesh Soni – 2018-06-12T18:44:49.180

1@KalpeshSoni Answer updated to reflect more recent versions. – Paul – 2018-06-12T22:16:16.153