ajout d’alias dans MS-DOS¶
First we’ll create a bat file with all the aliases as doskey macros.
- Create a text file.
- Open the file for editing and add aliases in the following way:
@echo off
@doskey ls=ls --color $*
@doskey ll=ls -la --color $*
@doskey vi="C:\Program Files\Vim\vim73\vim.exe" $*
@doskey h=doskey /history
@doskey ssh="C:\Program Files\putty\plink.exe" -v -ssh $*
@doskey edit="C:\Program Files\Vim\vim73\vim.exe" $*
@doskey ps=pslist $*
@doskey top="pmon"
- Save the file with a .bat extension. Eg. alias.bat
Now we’ll make a tiny change in the registry so that this batch file is run whenever command prompt is launched.
- Open Run (Win+R), type regedit and press enter.
- Navigate to HKEY_CURRENT_USER/Software/Microsoft/Command Processor
- Right click on Command Processor and create a new String Value. Name it autorun.
- Double click on autorun and enter the path of the batch file you created a short while back.
- Enter the path of the batch file
- Press OK and you are done.
source: http://www.uberullu.com/alias-in-windows-command-line-ms-dos-how-to/
On peut aussi ajouter des alias pour écouter en ligne de commandes ces radios préférées
@doskey franceinter="C:\Program Files\SMPlayer\mplayer\"mplayer.exe http://www.tv-radio.com/station/france_inter_mp3/france_inter_mp3-32k.m3u
@doskey franceinfo="C:\Program Files\SMPlayer\mplayer\"mplayer.exe http://www.tv-radio.com/station/france_info/france_info.m3u
ou faire des simples raccourcit sans utiliser le PATH:
@doskey putty="C:\Program Files\putty\putty.exe"
ou bien gérer des variables
@echo off
set PYTHONSTARTUP=C:\Users\f.aoustin.PROPLAST\pythonstartup.py
un exemple d’alias.bat complet
@doskey ls=ls --color $*
@doskey ll=ls -la --color $*.
@doskey winmax="C:\Program Files\term\"winmax.exe
@doskey h=doskey /history
@doskey ssh="C:\Program Files\putty\plink.exe" -v -ssh $*
@doskey sftp="C:\Program Files\PuTTY\psftp.exe" $*
@doskey check=ping 192.168.1.1 -t
@doskey vi="C:\Program Files\Vim\vim74\vim.exe" $*
@doskey vim="C:\Program Files\Vim\vim74\vim.exe" $*
@doskey edit="C:\Program Files\Vim\vim74\vim.exe" $*
@doskey diff="C:\Program Files\Vim\vim74\diff.exe" $*
@doskey top="C:\Program Files\Glances\glances.exe"
@doskey sniff="C:\Program Files\Nmap"\nmap.exe -T4 -A -v $*
@doskey franceinter="C:\Program Files\SMPlayer\mplayer\"mplayer.exe http://mp3.live.tv-radio.com/franceinter/all/franceinterhautdebit.mp3
@doskey franceinfo="C:\Program Files\SMPlayer\mplayer\"mplayer.exe http://mp3.live.tv-radio.com/franceinfo/all/franceinfo.mp3
@doskey europe1="C:\Program Files\SMPlayer\mplayer\"mplayer.exe http://vipicecast.yacast.net/europe1
@doskey rtl="C:\Program Files\SMPlayer\mplayer\"mplayer.exe http://streaming.radio.rtl.fr:80/rtl-1-44-96
@doskey putty="C:\Program Files\putty\putty.exe"
@doskey python="C:\Python\Python27\python.exe" $*
@doskey python3="C:\Python\Python33\python.exe" $*
@doskey python27="C:\Python\Python27\python.exe" $*
@doskey python33="C:\Python\Python33\python.exe" $*
@doskey python32="C:\Python\Python32\python.exe" $*
@doskey tail="C:\Program Files\term\"tail.exe $*
@doskey csql="C:\Program Files\csql\"csql.exe $*
@doskey svn="C:\Program Files\TortoiseSVN\bin\"svn.exe $*
@doskey svn_info="C:\Program Files\TortoiseSVN\bin\"svn.exe st $*
@doskey svn_add="C:\Program Files\TortoiseSVN\bin\"svn.exe add $*
@doskey svn_del="C:\Program Files\TortoiseSVN\bin\"svn.exe del $*
@doskey svn_commit="C:\Program Files\TortoiseSVN\bin\"svn.exe commit $*
@doskey svn_update="C:\Program Files\TortoiseSVN\bin\"svn.exe update $*
@doskey svn_revert="C:\Program Files\TortoiseSVN\bin\"svn.exe revert $*
@doskey svn_log="C:\Program Files\TortoiseSVN\bin\"svn.exe log $*
@echo off
set PYTHONSTARTUP=C:\Users\f.aoustin.PROPLAST\pythonstartup.py
"C:\Program Files\term\"winmax.exe
chcp 1252
cls
Note
le chcp + cls est ajouter afin de pouvoir utiliser vim sous windows 8
il est posssible dans un @doskey d’additionner les commandes en les séparant par $T (utile si on veut utiliser winmax avant certaines fonctions comme vi)
exemple
@doskey vi="C:\Program Files\term\"winmax.exe $T "C:\Program Files\Vim\vim74\vim.exe" $*
@doskey vim="C:\Program Files\term\"winmax.exe $T "C:\Program Files\Vim\vim74\vim.exe" $*
@doskey edit="C:\Program Files\term\"winmax.exe $T "C:\Program Files\Vim\vim74\vim.exe" $*
@doskey python3="C:\Program Files\term\"winmax.exe $T "C:\Python\Python33\python.exe" $*
@doskey python27="C:\Program Files\term\"winmax.exe $T "C:\Python\Python27\python.exe" $*
@doskey python33="C:\Program Files\term\"winmax.exe $T "C:\Python\Python33\python.exe" $*
@doskey python32="C:\Program Files\term\"winmax.exe $T "C:\Python\Python32\python.exe" $*
@doskey csql="C:\Program Files\term\"winmax.exe $T "C:\Program Files\csql\"csql.exe $*