Windows CMD Shorten file path -


i got gnu utilities adds command sed windows, use have type:

c:\programfiles\gnuwin32\bin\sed.exe <args> 

how shorten sed <args>?

to run executable without full path, needs either in current directory, or in path environment variable. in cmd prompt, there several ways this.

the first way put c:\programfiles\gnuwin32\bin in path variable, makes every program in directory available without full path.

set "path=%path%;c:\programfiles\gnuwin32\bin" 

this updates path in current command prompt. if need set other cmd windows, see how persistently set variable in windows 7 batch file?

the second method have sed.exe in current directory. obvious way change directories.

cd c:\programfiles\gnuwin32\bin sed 

or can copy current directory.

copy c:\programfiles\gnuwin32\bin\sed.exe .\ sed 

(this works sed.exe because it's self-contained utility. don't try windows application excel.exe)

finally, can create "redirect" somewhere in current directory or path.

>.\sed.bat echo c:\programfiles\gnuwin32\bin\sed.exe %* 

this creates batch file in current directory called sed.bat calls full sed.exe. can drop file directory in path.

mklink .\sed.exe c:\programfiles\gnuwin32\bin\sed.exe 

this creates symlink sed.exe in current directory, symlink in unix or shortcut in windows.


Comments