How can I create an icon\shortcut to a script that opens cmd.exe command prompt at a certain location on a certain drive under Win7?


i don't know in windows 7, but in windows xp and previous:

  • create a shortcut to c:\windows\system32\cmd.exe
  • right-click -> properties
  • in the "start in" write the desired target folder (e.g. f:\aviv\geffen)

click ok, and there you go.

  • This is the best answer to the question I've asked, however the /K based approach in my answer is more flexible, e.g. cd somewhere and then run a script or two. – Jonathan Jan 5 '12 at 18:54

Create a shortcut to cmd.exe, then go to its properties and edit the Target:

C:\Windows\System32\cmd.exe /K "D: & cd eclipse"

This would first change the current directory to D: and then cd into eclipse folder

  • 1
    So, you found the answer to your own question then? :) – Oldskool Jan 3 '12 at 13:44
  • Or change the value in the "Start in:" field to the drive and folder you wish to start CMD.EXE in. The default value is %HOMEDRIVE%%HOMEPATH% which can be configured to be otherwise. – Isxek Jan 3 '12 at 13:44
  • 1
    @Oldskool - yup :) – Jonathan Jan 3 '12 at 15:27
  • A better way of expressing the command would be "cd /d d:\eclipse". – BillP3rd Jan 4 '12 at 13:58
  • You should mark this as the answer to the question so people don't attempt to answer it. – Ramhound Jan 4 '12 at 14:09

Within Windows 7 you can just hold down the Shift key when right clicking a location and the Open Command Window Here option will then appear in the right-click menu. The starting location (path) is your right-click destination!

For previous versions of Windows, I came across this plug-in which inserts a 'Open Command Prompt' option into the right click menu - it will open it in the current folder/multiple command prompts in multiple locations with just a few clicks.

  • 1
    This doesn't answer the actual question of doing this from within a script. And furthermore since Win7 there's no need for a plugin, just hold down the Shift key when right clicking a location and the "Open command window here" option will then appear in the menu. – Oldskool Jan 3 '12 at 13:59
  • You should've posted that as an answer then, i'm pretty sure the OP is totally unaware of this feature - as was i. I'll edit my answer to contain it. – HaydnWVN Jan 4 '12 at 10:58
  • It doesn't read that the OP is using a script, he asked if a script was the solution – HaydnWVN Jan 5 '12 at 11:12
  • 1
    This is exactly what i was searching for. Thanks for the tip. – Jayy Feb 3 '16 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.