I am running Windows 7 and when I run cmd.exe I want it to start up in a directory named C:\foo\bar. I remember being able to create a link to this executable on the desktop and right clicking somewhere to set the startup menu of the cmd.exe command prompt by filling out a field in a transient window, but I cannot find it. I have found the following argument which however seems more complicated. I want to set the startup directory for cmd.exe via a popup window.
Changing default startup directory for command prompt in Windows 7
Any ideas?
as mentioned by the other posters already: the regular approach is to edit the shortcut's properties and fill the field labled "start in". simple as that.
however, for some reason this has no effect on UAC enabled systems if at the same time you also enable the "run as administrator" checkbox in the advanced properties of the shortcut.
a solution is to put everything in the "target" field of the shortcut:
%windir%\System32\cmd.exe /K cd /d "E:\My Folder" & sometest.bat
when running on 64bit and you want to explicitly start the 32bit flavour of the command prompt:
%windir%\SysWOW64\cmd.exe /K cd /d "E:\My Folder" & sometest.bat
for additional information on the command line parameters used above see:cmd.exe /?
cd.exe /?
When you create a shortcut to cmd.exe, you can open the shortcut properties and find under Shortcut tab the Starts in option that will tell cmd.exe
where to start, like here:
Open the properties of a shortcut to cmd
and set the directory there:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With