首页  编辑  

Doskey命令别名[原创]

Tags: /计算机文档/DOS应用技巧/   Date Created:

The best & useful & powerful DOSKEY defines ever!

史上最强的DOSKEY宏定义集锦

如何给命令提示符设置别名

http://superuser.com/questions/49170/create-an-alias-in-windows-xp

利用doskey完成,例如:

doskey d=dir $*

如果要永久起作用,可以利用一个alias命令文件,修改注册表:

reg add "hkcu\software\microsoft\Command Processor" /v Autorun /t reg_sz /d "DOSKEY /macrofile=D:\Tools\doskey-macros.txt"

然后把所有的别名命令放在D:\Tools\doskey-macros.txt中,启动cmd会自动加载这个文件。

其中D:\Tools\doskey-macros.txt内容类似下面:

vi="C:\Program Files\Notepad++\notepad++.exe" $*
ls=dir /w $*
ll=dir /a $*
cat=type $*
rm=del $*
bash="C:\Program Files\Git\git-bash.exe" 
`=pushd %UserProfile%
~=pushd %UserProfile%
desk=cd %UserProfile%\Desktop
-=popd
cdd=pushd $*
pwd=cd
macro=doskey /macros
list=doskey /macros | findstr /i $*=
kill=taskkill /f /im:$*
up=systeminfo | find "启动时间"
boottime=@for /f "tokens=2 delims==" %G in ('wmic os get lastbootuptime /value') do @echo %G
uptime=powershell -encodedCommand JABiAG8AbwB0ACAAPQAgACgARwBlAHQALQBDAGkAbQBJAG4AcwB0AGEAbgBjAGUAIAAtAEMAbABhAHMAcwBOAGEAbQBlACAAVwBpAG4AMwAyAF8ATwBwAGUAcgBhAHQAaQBuAGcAUwB5AHMAdABlAG0AKQAuAEwAYQBzAHQAQgBvAG8AdABVAHAAVABpAG0AZQA7ACQAdQBwAHQAaQBtAGUAIAA9ACAAJAB1AHAAdABpAG0AZQAgAD0AIAAoAEcAZQB0AC0ARABhAHQAZQApACAALQAgACQAYgBvAG8AdAA7ACcAL1SoUo5OIAAnACAAKwAgACQAYgBvAG8AdAAgACsAIAAnAAz/8l3Qj0yIIAAnACAAKwAgACQAdQBwAHQAaQBtAGUALgBEAGEAeQBzAC4AVABvAFMAdAByAGkAbgBnACgAKQAgACsAIAAnACAAKVkgACcAIAArACAAJAB1AHAAdABpAG0AZQAuAEgAbwB1AHIAcwAuAFQAbwBTAHQAcgBpAG4AZwAoACkAIAArACAAJwAgAA9c9mUgACcAIAArACAAJAB1AHAAdABpAG0AZQAuAE0AaQBuAHUAdABlAHMALgBUAG8AUwB0AHIAaQBuAGcAKAApACAAKwAgACcAIAAGUp+UJwA=
gc=git clone $*
..=cd ..
...=cd ..\..
....=cd ..\..\..
post=curl --ssl-no-revoke -A "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36" -e "$1" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7" -H "Accept-Language: zh-CN,zh;q=0.9" -H "Accept-Encoding: identity" -H "X-Requested-With: XMLHttpRequest" -F "file=@$2" $1 $3 $4 $5 $6 $7 $8 $9
wgeta=wget -r -p -np -k -b -t 3 -c -T 30 $*
reload=doskey /macrofile=D:\Tools\doskey-macros.txt
nl=netstat -nao | find "LISTEN"
ip=ipconfig /all | find "  IPv4 "
dns=ipconfig /all | find "  DNS "
http=curl --ssl-no-revoke -k -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0" -e "$1" $1 $2 $3 $4 $4 $6 $7 $8 $9
proxy=set https_proxy=$1&set http_proxy=$1&set socks_proxy=$1
pl=set https_proxy=http://127.0.0.1:8080 & set http_proxy=http://127.0.0.1:8080 & set socks_proxy=http://127.0.0.1:8080
pt=pushd E:\IdeaProjects\ProxyTester & pt.py -o result.txt
gitpath=set path=%path%;C:\Program Files\Git\usr\bin
edr=backstab -n edr_monitor.exe -k
bs=backstab -n $1 -k
sudo=nsudo -P:E -U:S $*
when=wmic process get processid,caption,creationdate | findstr /c:CreationDate /c:$*
kt="..\..\bin\keytool.exe" -import -file "$1" -keystore cacerts -storepass changeit
tcc=D:\tools\tcc\tcc $*
twc=D:\tools\tcc\tcc -DUNICODE -Wl,-subsystem=windows -m64 -Os -O $*
kafka=kafka-console-producer.bat --broker-list localhost:9092 --topic $*
kafkaclean=echo {"partitions":[{"topic":"$1", "partition":0, "offset":-1}]}>%temp%\kf_clean.json && kafka-delete-records.bat --bootstrap-server localhost:9092 --offset-json-file %temp%\kf_clean.json && del %temp%\kf_clean.json
wql=powershell -command "Get-WmiObject -query '$*'"
wmi=powershell -command "Get-WmiObject -Namespace 'root\WMI' -Query '$*'"
res=wmic path Win32_VideoController get CurrentHorizontalResolution, CurrentVerticalResolution, CurrentBitsPerPixel
class=powershell -command "Get-WmiObject -Namespace 'root\$1' -List | Select-Object -ExpandProperty Name"
ps=powershell -command "$*"
env=rundll32.exe sysdm.cpl,EditEnvironmentVariables
vm=D:\Tools\VM\vm.sh $*
rdp=cmd /c D:\Tools\frp\frpc.exe -c D:\Tools\frp\frpc.ini
rdpfree=cmd /c D:\Tools\frp\frpc.exe -c D:\Tools\frp\frpc_free.ini
dr=icacls $1 /remove:d Everyone
de=icacls $1 /deny Everyone:F
admin=net localgroup "administrators" %username% /add
gitfind=@for /f %i in ('@git rev-list --all') do @git grep -F "$1" %i
root=mysql -u root -p password < D:\tools\sql.sql
ufw=if "$1"=="add" (netsh advfirewall firewall add rule name="Open Port $2" protocol=TCP dir=in localport=$2 action=allow) else if "$1"=="del" (netsh advfirewall firewall delete rule name="Open Port $2" protocol=TCP localport=$2)
gf=git fetch --tags -f
patchs=wmic qfe list full /format:htable > %temp%\patchs.html $T %temp%\patchs.html
t=cd D:\Tools $T D: > nul
\=cd \
get=set | findstr /i $*=
ap=set path=%path%;$*
psexec=nircmd.exe elevatecmd runassystem $*
psencode=powershell ^$c = Get-Content -path $1 -Raw; ^$s = [System.Text.Encoding]::Unicode.GetBytes(^$c); [convert]::ToBase64String(^$s)
psdecode=powershell ^$s= [System.Convert]::FromBase64String("""$1"""); [System.Text.Encoding]::Unicode.G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AZwBBAHMAeQBuAGMAKAApACAAfAAgAE8AdQB0AC0ATgB1AGwAbAAKACAAIAAgACAAZQBjAGgAbwAgACIASABvAHQAcwBwAG8AdAAgAHMAdABvAHAAcABlAGQAIgAKACAAIAAgACAAcwBsAGUAZQBwACAAMwAKAH0AIABlAGwAcwBlACAAewAKACAAIAAgACAAJAB0AG0ALgBTAHQAYQByAHQAVABlAHQAaABlAHIAaQBuAGcAQQBzAHkAbgBjACgAKQAgAHwAIABPAHUAdAAtAE4AdQBsAGwACgAgACAAIAAgAGUAYwBoAG8AIAAiAEgAbwB0AHMAcABvAHQAIABzAHQAYQByAHQAZQBkACIACgAgACAAIAAgAHMAbABlAGUAcAAgADMACgB9AA==
touch=@for %f in ($*) do @if not exist %f (@type null>%f 2> nul) else (@powershell ^(Get-Item "%f"^).LastWriteTime = Get-Date)
mcd=md $1 && cd $1
cleancache=RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8
clean=@del /q/f/s %TEMP%\* & @for /d %i in ("%TEMP%\*") do @rmdir /q/s "%i" 2>nul $T @del /q/f/s %windir%\Temp\* & @for /d %i in ("%windir%\Temp\*") do @rmdir /q/s "%i" 2>nul
lc=findstr /R /N "^" $1 | find /C ":"
mb=mysqldump -u $1 -p$2 --all-databases > $3
mb2=@for /f "tokens=1-3 delims=." %a in ('wmic os get localdatetime ^| find "."') do @set date=%a & mysqldump -u $1 -p$2 --all-databases > mysql_backup_%date:~0,4%-%date:~4,2%-%date:~6,2%.sql
bigfile=for /r %i in (*) do @if %~zi gtr $1 echo %i
md5file=certutil -hashfile $1 MD5
myip=curl ipinfo.io/ip
diskusage=wmic logicaldisk get size,freespace,caption
zip=tar -cf $*
unzip=tar -xf $1 -C $2
now=echo %date% %time%
today=echo %date%
df=wmic logicaldisk get size,freespace,caption
regs=reg add "$1" /v "$2" /t REG_SZ /d "$3" /f
regd=reg add "$1" /v "$2" /t REG_DWORD /d $3 /f
reboot=shutdown /r /t 0
lock=Rundll32.exe User32.dll,LockWorkStation
ifconfig=ipconfig $*
h=cd %HOMEPATH%
d=cd %HOMEPATH%\Documents
.=start .
w=cd /d %windir%
s=cd /d %windir%\System32
tmp=cd /d %temp%
lsd=dir /a /o /s $*
f=dir /b /a $*
pb=ping www.baidu.com
p=@echo $1 | find "." > nul $T @if %errorlevel% equ 0 (@ping $1) else (@ping www.$1.com)
pg=ping www.google.com
n=@echo $1 | find "." > nul $T @if %errorlevel% equ 0 (echo. & @nslookup $1) else (echo. & @nslookup www.$1.com)
his=if "$1"=="" (doskey /history) else (doskey /history | find "$1")
mv=move $*
cp=copy $*
cpu=wmic cpu get loadpercentage
dl=powershell -command "(New-Object Net.WebClient).DownloadFile('$1', '$2')"
download=powershell -command "Invoke-WebRequest -UseBasicParsing '$1' -OutFile '$2'"
tr=tracert -d $*
host=if not "$2" == "" (findstr /C:"$2" %SystemRoot%\System32\drivers\etc\hosts>nul || echo $1 $2>> %SystemRoot%\System32\drivers\etc\hosts && echo 添加域名映射 $1 $2 成功!)
dird=dir /s /b /ad $*
dirf=dir /s /b /a:-d $*
prog=cd /d %ProgramFiles%
progx86=cd /d %ProgramFiles(x86)%
mdd=md %date:/=-%
rde=@for /f "delims=" %i in ('dir /ad /b /s $1 ^| sort /r') do @rd /q "%i" 2> nul && @echo 已删除空目录 %i
vihost=notepad %SystemRoot%\System32\drivers\etc\hosts
sudo=powershell -Command "Start-Process cmd -ArgumentList '/k $*' -Verb RunAs"
rand=powershell "-join ((65..90) + (97..122) + (48..57) | Get-Random -Count $1 | % { [char]$_ })"
rand2=powershell "Add-Type -AssemblyName System.Web;[System.Web.Security.Membership]::GeneratePassword($1, 0)"
eval=powershell -Command "Write-Output $((Invoke-Expression '$*'))"
pslist=cmd /c powershell "Get-CimInstance Win32_Process | ForEach-Object { write-host $_.ProcessId $_.CommandLine }"
pstree=cmd /c powershell -encodedCommand JABwACAAPQAgAEcAZQB0AC0AQwBpAG0ASQBuAHMAdABhAG4AYwBlACAALQBDAGwAYQBzAHMATgBh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G4AZABDAGgAaQBsAGQAUAByAG8AYwBlAHMAcwBlAHMAIAAwACAAJABfACAAfQA=
alias=if ".$*." == ".." ( DOSKEY /MACROS ) else ( DOSKEY $* )
apps=powershell "Get-WmiObject -Class Win32_Product -ComputerName . | Format-Wide -Column 1"
ata=schtasks /create /tn "$1" /tr "$3 $4 $5 $6 $7 $8 $9" /sc once /st $2 /f
atd=schtasks /delete /tn "$1"
atr=schtasks /run /tn "$1"
task=schtasks /create /tn "tempTask" /it /tr "$*" /sc once /st:23:59 /f /rl highest /ru "SYSTEM" & schtasks /run /tn "tempTask" & schtasks /delete /tn "tempTask" /f
block=netsh advfirewall firewall add rule name="Block_$1" dir=in action=block remoteip=$1
unblock=netsh advfirewall firewall delete rule name="Block_$1"
ded=forfiles /m $1 /d -$2 /c "cmd /c del @file"
filefrom=@forfiles /S /D +$1 /C $2 "cmd /c echo @path"
filebefore=@forfiles /S /D -$1 /C $2 "cmd /c echo @path"
which=@for %e in (%PATHEXT%) do @for %i in ($1%e) do @if exist %~$PATH:i (@echo %~$PATH:i)
which2=@for %i in ($1) do @if exist %~$PATH:i (@echo %~$PATH:i)
nata=netsh firewall add portopening TCP $1 "端口映射 $1 => $2:$3" && netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=$1 connectaddress=$2 connectport=$3
natd=netsh interface portproxy delete v4tov4 listenaddress=0.0.0.0 listenport=$1 && netsh firewall delete portopening TCP $1 > nul
natl=netsh interface portproxy show all
big20=powershell "Get-ChildItem $1 -Recurse | Sort-Object Length -Descending | Select-Object -First 20 | Format-Table Length, FullName"
randstr=powershell "$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; if ('$2' -eq '/s') { $chars +='!@#$%^&*()-_=[]+''/\' };$password = -join ((0..$1) | ForEach-Object { $chars[(Get-Random -Maximum $chars.Length)] });Write-Output $password"
last=powershell "Get-EventLog -LogName Security | Where-Object {$_.InstanceId -eq 4624 -and ($_.ReplacementStrings[8] -eq '2' -or $_.ReplacementStrings[8] -eq '10')} | Select-Object @{Name='Time';Expression={$_.TimeGenerated}},@{Name='User';Expression={$_.ReplacementStrings[5]}},@{Name='Type';Expression={if ($_.ReplacementStrings[8] -eq '2') {'Console'} else {'RDP'}}} | Sort-Object Time -Descending | Select-Object -Unique -Property Time, User, Type | Select-Object -First 20"
boot=powershell "(Get-CimInstance -ClassName Win32_OperatingSystem).LastBootUpTime"
du=powershell "$size = (Get-ChildItem $1 -Recurse | Measure-Object -Property Length -Sum).Sum / 1MB;""$1  Total size: $size MB"""
timestamp=powershell """UNIX Timestamp: $([int](Get-Date -UFormat %s))"""
top=powershell -encodedCommand JABwAD0AQAB7AH0AOwAkAHMAPQBHAGUAdAAtAEQAYQB0AGUACgB3AGgAaQBsAGUAKAAkAHQAcgB1AGUAKQB7AEMAbABlAGEAcgAtAEgAbwBzAHQAOwAkAGMAPQBHAGUAdAAtAEQAYQB0AGUAOwAkAHAATABpAHMAdAA9AEcAZQB0AC0AUAByAG8AYwBlAHMAcwB8AFMAZQBsAGUAYwB0ACAASQBkACwAUAByAG8AYwBlAHMAcwBOAGEAbQBlACwAQwBQAFUALABXAG8AcgBrAGkAbgBnAFMAZQB0ADYANAA7ACQAZAA9ACgAJABjAC0AJABzACkALgBUAG8AdABhAGwAUwBlAGMAbwBuAGQAcwA7ACQAdQA9ACQAcABMAGkAcwB0AHwARgBvAHIARQBhAGMAaAAtAE8AYgBqAGUAYwB0AHsAaQBmACgAJABwAC4AQwBvAG4AdABhAGkAbgBzAEsAZQB5ACgAJABfAC4ASQBkACkAKQB7ACQAcAByAGUAdgBDAFAAVQA9ACQAcABbACQAXwAuAEkAZABdAC4AQwBQAFUAOwAkAGQAZQBsAHQAYQBDAFAAVQA9ACQAXwAuAEMAUABVAC0AJABwAHIAZQB2AEMAUABVADsAJABjAHAAdQBQAD0AWwBtAGEAdABoAF0AOgA6AFIAbwB1AG4AZAAoACgAJABkAGUAbAB0AGEAQwBQAFUALwAkAGQALwAkAGUAbgB2ADoATgBVAE0AQgBFAFIAXwBPAEYAXwBQAFIATwBDAEUAUwBTAE8AUgBTACkAKgAxADAAMAAsADIAKQB9AGUAbABzAGUAewAkAGQAZQBsAHQAYQBDAFAAVQA9ADAAOwAkAGMAcAB1AFAAPQAwAH0AJABwAFsAJABfAC4ASQBkAF0APQBbAFAAUwBDAHUAcwB0AG8AbQBPAGIAagBlAGMAdABdAEAAewBJAGQAPQAkAF8ALgBJAGQAOwBDAFAAVQA9ACQAXwAuAEMAUABVAH0AOwBbAFAAUwBDAHUAcwB0AG8AbQBPAGIAagBlAGMAdABdAEAAewBJAGQAPQAkAF8ALgBJAGQAOwBQAHIAbwBjAGUAcwBzAE4AYQBtAGUAPQAkAF8ALgBQAHIAbwBjAGUAcwBzAE4AYQBtAGUAOwBDAFAAVQBQAGUAcgBjAGUAbgB0AD0AJABjAHAAdQBQADsATQBlAG0AbwByAHkATQBCAD0AWwBtAGEAdABoAF0AOgA6AFIAbwB1AG4AZAAoACQAXwAuAFcAbwByAGsAaQBuAGcAUwBlAHQANgA0AC8AMQBNAEIALAAyACkAfQB9AHwAUwBvAHIAdAAtAE8AYgBqAGUAYwB0ACAAQwBQAFUAUABlAHIAYwBlAG4AdAAgAC0ARABlAHMAYwBlAG4AZABpAG4AZwB8AFMAZQBsAGUAYwB0AC0ATwBiAGoAZQBjAHQAIAAtAEYAaQByAHMAdAAgADMAMAA7ACQAdQB8AEYAbwByAG0AYQB0AC0AVABhAGIAbABlACAASQBkACwAUAByAG8AYwBlAHMAcwBOAGEAbQBlACwAQwBQAFUAUABlAHIAYwBlAG4AdAAsAE0AZQBtAG8AcgB5AE0AQgAgAC0AQQB1AHQAbwBTAGkAegBlADsAJABzAD0ARwBlAHQALQBEAGEAdABlADsAUwB0AGEAcgB0AC0AUwBsAGUAZQBwACAALQBTAGUAYwBvAG4AZABzACAAMQB9AA==
topwebsites=powershell "Get-DnsClientCache | Group-Object Name | Sort-Object Count -Descending | Select-Object -First 10 | Format-Table Name, Count"
dup=powershell "Get-ChildItem -Recurse $1 | Get-FileHash | Group-Object Hash | Where-Object { $_.Count -gt 1 } | ForEach-Object { Write-Host """$($_.Name):"""; $_.Group | ForEach-Object { Write-Host """    $($_.Path)""" }; Write-Host '' }"
grep=find /i $*
useradd=net user $1 /add
userdel=net user $1 /del
clear=cls
e=explorer %userprofile%
gl=git pull
gt=git push
gm=git commit -m "$*"
ga=git add $*
gs=git status $*
gf=git fetch $*
gco=git checkout $*
gb=git branch $*
gbd=git branch -d $*
gba=git branch -a $*
gbr=git branch -r $*
adu=powershell "Get-ADUser -Filter * -Property * | ForEach-Object { if (($_ | Out-String) -match '$*') { '-' * 80; $_ } }"
ad=powershell "Get-ADUser -Filter * -Property Description, DisplayName, EmailAddress, Office, telephoneNumber, Title | ForEach-Object { if (($_ | Out-String) -match '$*') { $_ | Select-Object Description, DisplayName, EmailAddress, Office, telephoneNumber, Title } } | Format-Table -AutoSize"
listen=powershell -command "$1" | powershell -encodedCommand cABhAHIAYQBtAAoAKAAKAAkAWwBQAGEAcgBhAG0AZQB0AGUAcgAoAE0AYQBuAGQAYQB0AG8AcgB5ACkAXQBbAGkAbgB0AF0AJABwAG8AcgB0AD0AOAAwADgAMAAKACkACgAkAGcAawAgAD0AIAAkAHQAcgB1AGUACgAkAGwAIAA9ACAAJABuAHUAbABsAAoACgB0AHIAYQBwACAAewAKAAkAaQBmACAAKAAkAGwAIAAtAG4AZQAgACQAbgB1AGwAbAAgAC0AYQBuAGQAIAAkAGwALgBTAGUAcgB2AGUAcgAuAEMAbwBuAG4AZQBjAHQAZQBkACkAIAB7ACAAJABsAC4AUwB0AG8AcAAoACkAIAB9AAoACQAkAGcAawAgAD0AIAAkAGYAYQBsAHMAZQAKAAkAYwBvAG4AdABpAG4AdQBlAAoAfQAKAAoAdAByAHkAIAB7AAoACQAkAGwAIAA9ACAAWwBTAHkAcwB0AGUAbQAuAE4AZQB0AC4AUwBvAGMAawBlAHQAcwAuAFQA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ApACAAewAgAGIAcgBlAGEAawAgAH0ACgAJAAkACQAJAAkACQAJACQAdwAuAFcAcgBpAHQAZQBMAGkAbgBlACgAJABkACkACgAJAAkACQAJAAkACQB9ACAAZQBsAHMAZQAgAHsAIABTAHQAYQByAHQALQBTAGwAZQBlAHAAIAAtAE0AaQBsAGwAaQBzAGUAYwBvAG4AZABzACAAMQAwADAAIAB9AAoACQAJAAkACQAJAH0ACgAJAAkACQAJAH0AIABmAGkAbgBhAGwAbAB5ACAAewAKAAkACQAJAAkACQAkAGMALgBDAGwAbwBzAGUAKAApAAoACQAJAAkACQB9AAoACQAJAAkAfQApAC4AQQBkAGQAQQByAGcAdQBtAGUAbgB0ACgAJABjACkALgBBAGQAZABBAHIAZwB1AG0AZQBuAHQAKAAkAEgAbwBzAHQALgBVAEkAKQAuAEIAZQBnAGkAbgBJAG4AdgBvAGsAZQAoACkAIAB8ACAATwB1AHQALQBOAHUAbABsAAoACQAJAH0AIABlAGwAcwBlACAAewAgAFMAdABhAHIAdAAtAFMAbABlAGUAcAAgAC0ATQBpAGwAbABpAHMAZQBjAG8AbgBkAHMAIAAxADAAMAAgAH0ACgAJAH0ACgAKAH0AIABmAGkAbgBhAGwAbAB5ACAAewAKAAkAaQBmACAAKAAkAGwAIAAtAG4AZQAgACQAbgB1AGwAbAApACAAewAgACQAbAAuAFMAdABvAHAAKAApACAAfQAKAH0A
note=powershell "[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null;$x=[Windows.UI.Notifications.ToastNotificationManager];$y=$x::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText01);$y.GetElementsByTagName('text').Item(0).AppendChild($y.CreateTextNode("""$*"""))|Out-Null;$x::CreateToastNotifier('通知').Show([Windows.UI.Notifications.ToastNotification]::new($y))"
md5=powershell "$md5 = [System.Security.Cryptography.MD5]::Create();$hash = $md5.ComputeHash([System.Text.Encoding]::UTF8.GetBytes("""$*"""));[BitConverter]::ToString($hash).ToLower().replace('-', '')"
sha256=powershell "$sha256 = [System.Security.Cryptography.SHA256]::Create();$hash = $sha256.ComputeHash([System.Text.Encoding]::UTF8.GetBytes("""$*"""));[BitConverter]::ToString($hash).ToLower().replace('-', '')"
sys=SystemPropertiesAdvanced
search=findstr /s $1 $2
v2=D:\Tools\v2rayN\v2ray -c D:\Tools\v2rayN\guiConfigs\config.json
rerun=taskkill /f /im:$1.exe & $1 $2 $3 $4 $5 $6 $7 $8 $9
odt2docx=@for %f in (*.odt) do @"C:\Program Files\LibreOffice\program\soffice.exe" --headless --convert-to docx "%f"
iftop=powershell -encodedCommand JABIAG8AcwB0AC4AVQBJAC4AUgBhAHcAVQBJAC4AVwBpAG4AZABvAHcAVABpAHQAbABlACAAPQAgACcAaQBmAHQAbwBwACcACgAkAGEAZABhAHAAdABlAHIAIAA9ACAARwBlAHQALQBOAGUAdABBAGQAYQBwAHQAZQByACAAfAAgAFcAaABlAHIAZQAtAE8AYgBqAGUAYwB0ACAAewAgACQAXwAuAFMAdABhAHQAdQBzACAALQBlAHEAIAAiAFUAcAAiACAALQBhAG4AZAAgACQAXwAuAEgAYQByAGQAdwBhAHIAZQBJAG4AdABlAHIAZgBhAGMAZQAgAC0AZQBxACAAJAB0AHIAdQBlACAAfQAKAGkAZgAgACgAJABhAGQAYQBwAHQAZQByAC4AQwBvAHUAbgB0ACAALQBlAHEAIAAwACkAIAB7AAoACQBXAHIAaQB0AGUALQBIAG8AcwB0ACAAIgAqZ35iMFI7bahShHZpcgZ0UX9hUwz/wGjlZ1F/3H7ej6Vjdl7NkdWLAjAiAAoACQBlAHgAaQB0AAoAfQAKACQAcAByAGUAdgAgAD0AIABAAHsAfQAKACQAYQBkAGEAcAB0AGUAcgAgAHwAIABGAG8AcgBFAGEAYwBoAC0ATwBiAGoAZQBjAHQAIAB7ACAAJABwAHIAZQB2AFsAJABfAC4ATgBhAG0AZQBdACAAPQAgACQAXwAgAHwAIABHAGUAdAAtAE4AZQB0AEEAZABh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AAkAGMAdQByAC4AUwBlAG4AdABCAHkAdABlAHMALAAgACQAdAB4ACkACgAJAAkACQAkAHAAcgBlAHYAWwAkAGEAZABwAHQALgBOAGEAbQBlAF0AIAA9ACAAJABjAHUAcgAKAAkAfQAKAH0A
=exit


这个宏定义文件,提供以下强大的功能:

启动停止WIFI热点,封锁攻击来源的IP地址,随机密码,下载文件,修改 Hosts,sudo 提权,计算表达式,添加计划任务,删除当前目录及其子目录下所有空目录,添加、删除、列出端口映射,按树形列出系统运行的进程列表,列出系统当前进程的命令行,重启电脑,压缩解压文件,列出当前目录下的所有文件,列出当前目录下的所有目录,备份整个MySQL数据库,添加注册表项,计算文件MD5,Post上传文件,获取公网IP地址,运行WQL查询,运行WMI查询,查看进程启动时间,查看启动启动时间,查看系统运行时长(类似uptime),查找指定大小文件,强杀进程,设置DOS程序代理,对指定文件拒绝/允许任何人访问,添加防火墙端口,编码解码Powershell代码,touch指令,清理临时文件释放磁盘空间,列出最近登录的用户名(类似Linux last)等等其他便捷功能共130余项,部分功能需要第三方工具协助未予以列出,计算单行字符串的MD5、SHA256。

listen 8080,本地启动8080端口监听,并回显用户输入,用于测试端口是否可以被访问。


其中AD宏,需要预先安装Powershell cmdlet Get-ADUser:  在Powershell中,运行 Add-WindowsCapability -Online -Name "Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0" 安装AD支持。

最好不要直接把 AutoRun设置为Bat或者Cmd文件,因为这样,在某些程序,如Jetbrains IDEA,VS Code或第三方调用Cmd的程序,启动的时候,不一定会正确切换到 Working Directory(工作目录),例如正常情况下 Idea 打开命令提示符终端,会自动切换到 $PROJECT_DIR$ 目录,但是如果设置 AutoRun 为批处理文件后,会导致这个目录切换失败。