How do I change default startup directory for command prompt in Windows 7?
I usually do the following to start command prompt from C:\\
WIN-R (Run Promp
HKEY_CURRENT_USER\Software\Microsoft\Command Processor
string: Autorun value: cd /d %~dp0
all bat files will run from the bat file location
I think the easiest way is to make a cmd
shortcut, then change the shortcut's "Start in" directory to the one you want to start with.
changing shortcut under Windows System on 8.1 worked for me - another thing I found is that 'Start In:' WORKS when Advanced -> Run as admin is UNCHECKED, however, if CHECKED, it does not work
Keep the opening of the command prompt clean. Avoid editing the registry key and adding an Autorun, it may come back to bite you.
Create a simple batch file and save it in the C:\Windows or C:\Windows\System32 folder. I call mine !.bat (exclamation mark). It has the following commands:
@echo off c: cd \ cls whoami
It goes to the folder where I need to work, clears the screen and tells me what security context I'm in.
Use Windows Terminal and configure a starting directory.
Partial settings.json
:
{
// Make changes here to the cmd.exe profile.
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "Command Prompt",
"commandline": "cmd.exe",
"hidden": false,
"startingDirectory": "C:\\DEV"
},