windows doskey alias
原文链接: windows doskey alias
https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-xp/bb490894(v%3dtechnet.10)
Install
Configure it to be started automatically whenever you open cmd. The setting is in Registry. In Windows 10, in the search box on the taskbar, type regedit.
- Find
HKCU\SOFTWARE\Microsoft\Command Processor
. HKCU might be HKEY_CURRENT_USER. - Right click, and click
New
. - Select
String Value
. - Rename to "AutoRun".
- Change data to the path where your aliases are saved. In my case: "C:\Users\$USERNAME\AppData".
%windir%\system32\cmd.exe /K doskeys.cmd
[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"AutoRun"="C:\Windows\System32\env.cmd"
reg add "hklm\software\microsoft\command processor" /v autorun /t reg_expand_sz /d "doskey /listsize=999 /macrofile=c:\users\opsdisk\doskey_macros.txt" /f
lock=@rundll32 user32.dll,LockWorkStation
env=@rundll32 sysdm.cpl,EditEnvironmentVariables
;= coreutils, util-linux, procps-ng
ls=dir /b /ogn $*
man=help $*
cat=type $*
rm=del $*
mv=move $1 $2
cp=copy $1 $2
ps=tasklist $*
kill=taskkill /f /im $*
killall=taskkill /f /t /im $*
poweroff=shutdown /s /t 0 /f
reboot=shutdown /r /t 0 /f
clear=cls
whereis=where $*
pwd=cd
grep=find /i $*
useradd=net user $1 /add
userdel=net user $1 /del
passwd=net user %username% *
ifconfig=ipconfig
ll=dir /-b
lsa=dir /ah $*
;= experimental
startx=start explorer.exe
init=taskkill /f /im explorer.exe
;= linux applications
buku=buku --nc $*
;= custom aliases
x=exit /b
xx=exit
h=doskey /history
ps=tasklist $*
ls=dir /a /x $*
lt=dir /a /x /od $*
d=cd %USERPROFILE%\desktop
p=ping yahoo.com -n 1 || ping 8.8.8.8 -n 1
findgrep=dir /s /a /b \*$1*
n=notepad $*
e=explorer .
cya=shutdown /f /s /t 0
reboot=shutdown /f /r /t 0
pspath=wmic process get processid,parentprocessid,executablepath
psg=tasklist | findstr /i $1
nsg=netstat -nao | findstr /i $1
nd=mkdir $1 $t cd $1
cp=copy $*
mv=move $*
ifconfig=ipconfig $*
macros=doskey /macros
ip=powershell -noni -nop -ep bypass -c "$c=new-object System.Net.WebClient;$e=$c.DownloadString('http://icanhazip.com');write-host $e"
..=cd ..
home=cd %USERPROFILE%
pepcheck=python -m flake8 $1 --ignore=E265,E501,W291,W293
:: http://technet.microsoft.com/en-us/library/bb490894.aspx
:: F7 = history
:: Alt+F7 = history -c
:: F8 = Ctrl+R
:: Use & to run multiple commands e.g.: command1 & command2
:: Add this file as a REG_SZ/REG_EXPAND_SZ registry variables in HKEY_LOCAL_MACHINE\Software\Microsoft\Command or Processor\AutoRun HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
@echo off
:: Linux commands
doskey alias = doskey $*
doskey cat = type $*
doskey clear = cls
doskey cp = copy $*
doskey cpr = xcopy $*
doskey grep = find $*
doskey history = doskey /history
doskey kill = taskkill /PID $*
::doskey ls = dir $*
doskey man = help $*
doskey mv = move $*
doskey ps = tasklist $*
doskey pwd = cd
doskey rm = del $*
doskey rmr = deltree $*
doskey sudo = runas /user:administrator $*
:: directory listing
doskey ls = dir
doskey lt = dir /b/a-d/od
doskey lta = dir /a-d/od
doskey la = dir /b/od
doskey ln = dir /on
doskey ld = /ad/od
:: GIT commands
doskey g = git $*
doskey gd = git diff
doskey gco = git checkout $*
doskey gcb = git checkout -b $*
doskey gre = git reset --hard $*
doskey gres = git reset HEAD~1 $*
doskey gr = git remote -v
doskey gb = git branch -v $*
doskey gs = git status $*
doskey gp = git push -u origin $*
doskey gbm = git branch -m $*
doskey gbd = git branch -D $*
doskey gc = git commit -am " $* "
doskey gst = git stash $*
doskey gsta = git stash apply $*
doskey gf = git fetch $*
doskey gh = git --help
doskey pull = git pull $*
doskey push = git push $*
doskey gist=git commit -am "" --allow-empty-message $T git push origin master
doskey grupdate = "git fetch upstream develop && git checkout develop && git merge upstream/develop && git push origin develop"
:: npm commands
doskey nu=npm update -g $*
doskey nig=npm install -g $*
doskey nis=npm install --save $*
doskey nisd=npm install --save-dev $*
doskey bis=bower install --save $*
doskey bisd=bower install --save-dev $*
doskey bb=youtube-dl -f bestvideo+bestaudio $*
doskey mp3=youtube-dl -f bestaudio -x --audio-format mp3 --embed-thumbnail $*
doskey yu=youtube-dl --update
doskey ph=python -m SimpleHTTPServer 80
doskey js=jekyll s -w -P 80 $*
doskey gor=go run $* main.go
doskey jsw=jekyll serve --watch $*
doskey ned=set NODE_ENV=development
doskey nes=set NODE_ENV=staging
doskey nep=set NODE_ENV=production
doskey psv=powershell -Command "& {$PSVersionTable.PSVersion}"
:: Launchers commands
doskey st = "C:\Program Files\Sublime Text 2\sublime_text.exe" $*
doskey fx = "C:\Program Files\Mozilla Firefox\firefox.exe" $*
doskey ie = "C:\Program Files\Internet Explorer\iexplore.exe" $*
doskey np = "C:\Users\SelectTV-02072017 wo\AppData\Local\slack\slack.exe" $*
doskey npp = "C:\Program Files (x86)\Notepad++\notepad++.exe" $*
doskey wm = "C:\Program Files (x86)\WinMerge\WinMergeU.exe" $*
doskey slack = "C:\Users\SelectTV-02072017 wo\AppData\Local\slack\slack.exe"" $*
:: System commands
doskey e = exit
doskey c = cd /
:: shot navigation
:: doskey ss = %USERPROFILE%\cmdtls\ss.cmd $*
doskey config = npp %USERPROFILE%\doskey.bat
DOSKEY cd~=cd %USERPROFILE%
DOSKEY cd!=cd %USERPROFILE%\AppData
DOSKEY cd#=cd %USERPROFILE%\Desktop
DOSKEY cd@=cd %USERPROFILE%\Documents
:: Misc commands
doskey lenv = ".\.venv\Scripts\activate.bat"
REM Set home path
if not defined HOME set HOME=%USERPROFILE%
:: Python commands
DOSKEY python2=C:\Python27\python.exe $*
DOSKEY pip2=C:\Python27\Scripts\pip2.exe $*
@echo off
doskey a=atom .
doskey e=explorer .
doskey x=exit
doskey s=cd C:\sites\
doskey r=cd C:\repos\
doskey w=cd C:\workspaces\
doskey c=cd ..
doskey ls=dir
doskey clear=cls
doskey home=c:
doskey gs=git status
doskey ga=git add --all
doskey gc=if $1. equ '' (git commit -m "commit") else (git commit -m "$*")
doskey gu=git push -u origin master
doskey gg=if $1. equ '' (git push) else (git push -u origin master)
doskey gp=git pull
doskey gr=git reset --hard origin/master
doskey jn=jupyter notebook
doskey dos=notepad.exe c:\windows\system32\env.cmd
doskey commands=notepad.exe c:\windows\system32\env.cmd
REM doskey v=echo 1
REM doskey vu=vagrant up
REM doskey vs=vagrant ssh
REM doskey dps=mix deps.get
REM doskey ism=iex -S mix
REM doskey isms=iex -S mix phx.Server
REM doskey touch=echo. 2>empty_file.txt
doskey pipinstall=if $1. equ '' (pip install .) else (pip install --trusted-host pypi.org $*)
doskey p=if $1. equ '' (python) else (python $*)
doskey py=if $1. equ '' (python) else (python $*)
doskey pt=if $1. equ '' (pytest) else (pytest $*)
doskey javahelp=echo "java commands: java -jar swirlds.jar | javac MyProgram.java | jar cfm MyProgram.java manefest.txt MyProgram.class | Main-Class: MyProgram [ENTER, ENTER]"
doskey ns=if $1. equ '' (npm start) else (npm run $*)
DOSKEY ls=dir $*
DOSKEY /=\
DOSKEY rm=del $*
DOSKEY rmd=rmdir /S /Q $*
DOSKEY cp=copy $*
DOSKEY mv=move $*
DOSKEY subl=sublime_text $*
cd c:\Users\evangelisto\Documents\programming
DOSKEY gs=git status
DOSKEY add=git add .
DOSKEY gp=git push
DOSKEY ls=dir
DOSKEY clear=cls
DOSKEY sudo=echo This Isn't Really Unix Dummy
DOSKEY system=cd C:\Windows\System32
DOSKEY home=cd C:\Users\tmyers
DOSKEY flow=git flow init -fd
DOSKEY hosts=code C:\Windows\System32\drivers\etc\hosts
DOSKEY root=cd /
cd /
cls
:: From a Unix lover to another ..
:: See https://github.com/jonasaberg91/DoskeyCmd for commands
@echo off
:: Linux commands
doskey alias = doskey $*
doskey cat = type $*
doskey clear = cls
doskey cp = copy $*
doskey cpr = xcopy $*
doskey grep = find $*
doskey history = doskey /history
doskey kill = taskkill /PID $*
doskey ls = dir $*
doskey man = help $*
doskey mv = move $*
doskey ps = tasklist $*
doskey pwd = cd
doskey rm = del $*
doskey rmr = deltree $*
doskey sudo = runas /user:administrator $*
:: Simplified Navigation
doskey .. = cd ..\$*
doskey ... = cd ..\..\$*
doskey .... = cd ..\..\..\$*
doskey ..... = cd ..\..\..\..\$*
:: Bind your own applications, uncomment to use
:: doskey macroname="PATH" $*
:: Example
:: doskey subl="C:\Program Files\Sublime Text 3\sublime_text.exe" $*
;= :: Linux commands
alias = doskey $*
cat = type $*
clear = cls
cp = copy $*
cpr = xcopy $*
grep = find $*
history = doskey /history
kill = taskkill /PID $*
ls = dir $*
man = help $*
mv = move $*
ps = tasklist $*
pwd = cd
rm = del $*
rmr = rd /s /q $*
sudo = runas /user:aridomain\rellis $1 $2
;= Easier navigation
;= alias o = start $*
;= alias oo = start .
.. = cd ..\$*
... = cd ..\..\$*
.... = cd ..\..\..\$*
..... = cd ..\..\..\..\$*
dockerup=docker-compose up -d nginx mysql
clear=cls
ls=dir /B $1
lss=dir /A $1
pwd=echo %cd%
touch=type nul > $1
..2=cd ../..