Windows 7: cmd.exe: configuring the startup directory (in the link to cmd.exe)

I am running Windows 7, and when I run cmd.exe, I want it to run in a directory named C: \ foo \ bar. I remember that I could create a link to this executable file on the desktop and right-click to set the initial cmd.exe command line menu by filling out the field in the transition window, but I can not find it. I have found the following argument, which, however, seems more complex. I want to set the cmd.exe startup directory through a popup.

Changing the default startup directory for the command line in Windows 7

Any ideas?

+6
source share
4 answers

as mentioned in other posters: the regular approach is to edit the properties of the shortcut and fill in the "start in" field. just like that.

however, for some reason this does not affect systems with UAC enabled, if at the same time you also enable the "run as administrator" checkbox in the advanced properties of the shortcut.

enter image description here

the 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 working on 64 bits, and you want to explicitly run the 32-bit taste of the command line:

 %windir%\SysWOW64\cmd.exe /K cd /d "E:\My Folder" & sometest.bat 



for more information about the command line options above:
cmd.exe /?
cd.exe /?

+16
source

When you create a shortcut for cmd.exe, you can open the shortcut properties and find the option โ€œLaunchesโ€ on the โ€œShortcutโ€ tab, which will tell cmd.exe where to start, as here:

Command Prompt Shortcut Properties

+7
source

Open the shortcut properties for cmd and set the directory there:

enter image description here

+4
source

Try this shortcut target:

 C:\Windows\System32\cmd.exe cd /d %~dp0 

Which will run cmd.exe in the shortcuts folder.

0
source

Source: https://habr.com/ru/post/919363/


All Articles