Sunday, April 4, 2010

#send to cmd.exe

here is an useful trick. wonder if you can always right click a file under windows and open the file location in a command prompt?

on win xp. navigate to:
"[Drive]:\Documents and Settings\[Username]\Sendto"

on vista or 7 the folder should be at:
"[Drive]:\users\[Username]\AppData\Roaming\Microsoft\Windows\SendTo"

create a new file called "SendTo.cmd", place the following line of code inside it and save:

@cmd /a /k cd /d %~d1%~p1
what this commands does is:
echo off, open cmd.exe with ansi output, carry out a command and remain, change directory to the first input file's drive and path

now every time you right click a file or a folder and call "Send To -> SendTo.cmd" you will have a command prompt with its parent folder open.

for example:
right clicking + "sendto.cmd" any file or sub-folder in "c:\windows\system32\"
will open a command prompt showing:
"c:\windows\system32>"

lubomir

1 comments:

  • ccernn

    in win7, you can also click the top-left folder icon, the small one to the left of the path/directory "buttons", and enter 'cmd', and you'll find yourself in a command line in that directory..