Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I often need to access some command line programs such as mysql. Is there a way to assign these programs a shortcut so I am no longer required to type whole paths? I think it's called symbolic links, but those are not present in xp from what I read. But it should be possible somehow, when I previously installed MySQL from installer, 'mysql' as a keyword to access the db was available everywhere in cmd.

I tried messing with the registry and setting system variables behind My Computer, but the only result was I could access these as %xyz% which is not exactly the same. Nothing else works.


share|improve this question
"to assing these programs" I think you meant "to assign these programs". –  Hello71 Aug 12 '10 at 18:07

3 Answers 3

up vote 0 down vote accepted

Do this: Get the full path to the mysql exe and copy this.

Right-click "My Computer" and then Properties, then Advanced, then Environment Variables.

You should have a variable called PATH. Edit this one. At the end of the current one you add a semicolon and the path to the directory where your mysql executable is placed so it looks like OLDPATH;PATHWHEREMYSQLEXECUTABLE is located

share|improve this answer
It makes sense now, thank you. –  jirkap Aug 12 '10 at 18:33

You could just add the directories to your path using...

setx path "%path%;c:\foo" -m

But what I usually do is make a very simple script for each command, and name it using the shortcut I want to use. All my scripts are placed in a directory that is added to the path. All I have to do to run the script is type that shortcut, whichever CD I am in.

You can also develop these scripts to use parameters, so that you can make complex commands very easy, without having to remember them.

This is basically what scripting is all about.

Here is an example of a simple script I made that shows the hard disk drive information for any machine on the network, using the Sysinternals command psinfo.exe. I saved it as driveinfo.cmd, and I can type driveinfo /? to remind me of the syntax.

@echo off

echo DriveInfo v1.1
REM dependencies:  psinfo.exe

if [%1] == [] goto :command
if [%1] == [/?] goto :help
set parm=%1
for %%U in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
call set "parm=%%parm:%%U=%%U%%"
if [%parm:~0,2%] == [\\] goto :command
goto :error

if [%1] == [] (
echo Drive information for %COMPUTERNAME%:
) else (
echo Drive information for %parm:~2%:
psinfo -d volume %1 2>nul | findstr /v "System information for" || (
goto :noresponse
goto :eof

echo Syntax error
goto :eof

echo %parm:~2% cannot be found
goto :eof

echo Usage: driveinfo [\\computer]
goto :eof
share|improve this answer
You get basically the same thing with: psinfo -d volume 2>nul | grep -e "Volume" -e "[A-Z]:" –  BillP3rd Aug 12 '10 at 18:57
So what are you saying? Use grep instead of findstr? Grep is not a standard CMD command, while findstr is. The GnuWin32 tools cannot be simply placed in a synced directory or flash drive either, so I cannot guarantee that I will have it on any machine I happen to be using. –  paradroid Aug 12 '10 at 19:08
Sure. A stand-alone grep would do, but yes, the GnuWin32 utilities can be installed on and run from a flash drive. The installer generates a shortcut that takes care of the necessary environment settings. BTW, my comment wasn't intended as a criticism and I hope you didn't interpret it as such. I like your driveinfo script. My intended contribution was merely to suggest a more concise (and readable) way of dealing with the output of psinfo.exe. NB. SETX is not a valid command in XP. –  BillP3rd Aug 12 '10 at 21:04
Okay, thanks - I get your point. I cannot even remember how I found out how findstr manages to deal with the psinfo output that way. The reason I did not use grep is that I find it a lot easier to only keep scripts and standalone executables in my command director, which I sync with all my machines and keep on USB flash drive. If there is a way to do that with the GnuWin32 commands, I'll look into that again. I totally forgot that setx is not included in XP as standard. –  paradroid Aug 13 '10 at 1:08

Since you mention symbolic links, you can download the GnuWin32 tools. The package you'll need is FileUtils which includes the "LN" command. Once installed, they'll need to be in the path. You can then create either symbolic links or hard links. You might like to create a folder for the purpose of housing your links. That folder would also need to be in the path.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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