Tạo alias cho Windows bằng DOSKEY

Lệnh doskey gọi Doskey.exe (để recall các dòng lệnh đã nhập trước đó), chỉnh sửa dòng lệnh và tạo macro.

1. Tạo file doskey:

Tên là macros.doskey bằng notepad hay sublime text

p = ping $*
t = telnet $*
c = cls
s = ssh root@$*
ip = ipconfig $*
route = route print -4
excel = "C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE"
animate = "C:\Program Files\Adobe\Adobe Animate 2022\Animate.exe"
authy = "C:\Users\lemin\AppData\Local\authy\Authy Desktop.exe"
web = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" $*
tim = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "? $*"
vpnserver = "C:\Program Files\SoftEther VPN Server\vpnsmgr_x64.exe"
mail = "C:\Program Files\Mozilla Thunderbird\thunderbird.exe"
sublime = "C:\Program Files\Sublime Text 3\sublime_text.exe"
word = "C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE"

2. Vào registry editor:

Windows + R: regedit

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\

  • Phải chuột và add a new “String Value” sub-key. Tên Autorun.
    Right-click -> New -> String Value
  • PPhải chuột và Modify the Value data.
    Right-click -> Modify -> Value data -> DOSKEY /MACROFILE=C:\macros.doskey

Cách khác chạy bằng cmd:

==> reg add "HKLM\Software\Microsoft\Command Processor" /v Autorun /d "doskey /macrofile=\"c:\macros.doskey\"" /f
The operation completed successfully.

==> reg query "HKLM\Software\Microsoft\Command Processor" /v Autorun

HKEY_CURRENT_USER\Software\Microsoft\Command Processor
Autorun REG_SZ doskey /macrofile=”c:\macros.doskey”

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *