windows command prompt modifications, add options, start loc

A place where you can post Python-related tutorials you made yourself, or links to tutorials made by others.

windows command prompt modifications, add options, start loc

Postby metulburr » Sun Jul 07, 2013 5:00 pm

change starting location of opening command prompt

This is a quick tutorial to change your command prompt auto start directory. Lets assume the directory starts in:
Code: Select all
C:\Windows\System32

and you always change directory back to
Code: Select all
 C:\Python33

At this point it is highly a convenience change for beginners with the command line, and thats it. You can go the GUI way or just insert a command in the command prompt (see below)

1) type in start:
Code: Select all
regedit.exe

and click on response, which should bring you to the registry editor

2) in the registry editor navigate path to:
win 7/8
HKEY_CURRENT_USER/Software/Microsoft/Command Processor
in Win 10 the path is
HKEY_LOCAL_MACHINE/Software/Microsoft/Command Processor

3)
which should have DefualtColor, Default, etc. etc. etc. If no autorun create one by right clicking... New -> string value
rename to
Code: Select all
autorun

right click on it again, and choose modify
in Value data: insert
Code: Select all
cd /d C:\Python33

If there is an autorun string value already, then just change existing one

Or to simplify the whole thing just execute this in your command prompt:
Code: Select all
reg add "HKCU\Software\Microsoft\Command Processor" /v autorun /t REG_SZ /d
"cd /d c:\Python33"


4) open a new command prompt and it should auto change directory to the directory you specify, which in this case is C:\Python33

Add copy and paste to command prompt
By default this option is off. Open a command prompt, right click on the top panel -> Properties. check Quick Edit Mode. From there you can copy text from the command prompt by dragging the mouse over text and right clicking (which auto puts it into your clipboard), right click again to paste back into command prompt, or a regular manner with a drop down menu

Open directory in command prompt right click drop down menu option
Open (registry editor) by typing regex.exe into start/run dialog.

Navigate to key
Code: Select all
HKEY_CLASSES_ROOT\Directory\shell


Right click shell and select New -> Key
rename this new key "CommandPrompt". Set this key's Data value to the text you want to see in the drop down menu "Open Command Prompt Here".

Now right click on your new CommandPrompt key and make another new key below this key.
Right click CommandPrompt and select New -> Key
rename this new key "command" otherwise will not work. Set tis keys data value to
Code: Select all
cmd.exe /k cd %1


You do not have to restart, or close the registry editor for this to work. To do this you have to right click on a directory you want to open in cmd for the option to appear. This was tested on windows 10.
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 2138
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 3 guests