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.
echo DriveInfo v1.1
REM dependencies: psinfo.exe
echo.
if [%1] == [] goto :command
if [%1] == [/?] goto :help
setlocal
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
:command
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
:error
echo Syntax error
goto :eof
:noresponse
echo.
echo %parm:~2% cannot be found
goto :eof
:help
echo Usage: driveinfo [\\computer]
goto :eof