shortcut for opening cmd.exe at a certain location

2

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?

Jonathan

Posted 2012-01-03T13:28:30.110

Reputation: 3 371

Answers

10

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.

Berry Tsakala

Posted 2012-01-03T13:28:30.110

Reputation: 1 049

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 – 2012-01-05T18:54:46.100

6

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

Jonathan

Posted 2012-01-03T13:28:30.110

Reputation: 3 371

1So, you found the answer to your own question then? :) – Oldskool – 2012-01-03T13:44:02.013

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 – 2012-01-03T13:44:07.450

1@Oldskool - yup :) – Jonathan – 2012-01-03T15:27:10.057

A better way of expressing the command would be "cd /d d:\eclipse". – BillP3rd – 2012-01-04T13:58:39.960

You should mark this as the answer to the question so people don't attempt to answer it. – Ramhound – 2012-01-04T14:09:23.947

@Ramhound - I think I can only do that after 2 days if I answered my own question. But also - people may have different approaches, perhaps their solution will be better... – Jonathan – 2012-01-04T14:23:04.927

Try mine (originally Oldskool's) it's quicker and easier! :D – HaydnWVN – 2012-01-05T11:27:53.007

5

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.

HaydnWVN

Posted 2012-01-03T13:28:30.110

Reputation: 3 192

1This is exactly what i was searching for. Thanks for the tip. – Jayy – 2016-02-03T15:04:00.070

1This 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 – 2012-01-03T13:59:19.803

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 – 2012-01-04T10:58:46.600

It doesn't read that the OP is using a script, he asked if a script was the solution – HaydnWVN – 2012-01-05T11:12:47.463