Win之NirCmd:NirCmd的简介、安装、使用方法之详细攻略
Win之NirCmd:NirCmd的简介、安装、使用方法之详细攻略
NirCmd的简介
NIrCMD是一个小命令行实用工具,允许您在不显示任何用户界面的情况下执行一些有用的任务。通过使用简单命令行选项运行NIMRCD,可以在注册表中写入和删除值和键,将值写入INI文件,拨号到Internet帐户或连接到VPN网络,重新启动Windows或关闭计算机,创建文件快捷方式,更改创建/修改日期。一个文件,改变你的显示设置,关闭你的显示器,打开你的CD-ROM驱动器的门,以及更多…
NirCmd v2.81官网
NirCmd的安装
Download NirLauncher Package
NirCmd的使用方法
例如:nircmd setdefaultsounddevice
弹出盘符为J的光驱 |
NirCmd.exe cdrom open j: |
弹入盘符为Y的光驱 |
nircmd.exe cdrom close y: |
增加2000个单位的系统音量(最大65535) |
nircmd.exe changesysvolume 2000 |
降低5000个单位的系统音量(最大65535) |
nircmd.exe changesysvolume -5000 |
设置为最高音量 |
nircmd.exe setsysvolume 65535 |
设置为静音 |
nircmd.exe mutesysvolume 1 |
取消静音 |
nircmd.exe mutesysvolume 0 |
在静音与正常状态之间切换 |
nircmd.exe mutesysvolume 2 |
在桌面创建静音与正常状态切换命令的快捷方式 |
nircmd.exe cmdshortcut "~$folder.desktop$" "Switch Volume" mutesysvolume 2 |
关闭显示器 |
nircmd.exe monitor off |
启动默认屏保 |
nircmd.exe screensaver |
进入待机状态 |
nircmd.exe standby |
注销当前用户 |
nircmd.exe exitwin logoff |
弹出对话框,询问是否重启。选择是则重启电脑 |
nircmd.exe qboxcom "Do you want to reboot?" "question" exitwin reboot |
关闭computers.txt中指定的所有计算机 |
multiremote copy "c:\temp\computers.txt" exitwin poweroff force |
拨号连接到"My Internet" |
nircmd.exe rashangup "My Internet" |
设置IE窗口为75%透明度(192/256) |
nircmd.exe win trans ititle "internet explorer" 192 |
最小化所有的IE窗口 |
nircmd.exe win min class "IEFrame" |
关闭所有的IE窗口 |
nircmd.exe win close class "IEFrame" |
关闭所有的资源管理器窗口(我的电脑、文件夹等) |
nircmd.exe win close class "CabinetWClass" |
隐藏所有的IE窗口 |
nircmd.exe win hide class "IEFrame" |
显示所有的IE窗口(在用上面命令隐藏后) |
nircmd.exe win show class "IEFrame" |
把所有的顶级窗口居中 |
nircmd.exe win center alltop |
去掉我的电脑窗口的标题栏 |
nircmd.exe win -style title "my computer" 0x00C0000 |
恢复我的电脑窗口的标题栏(当用上面命令去除后) |
nircmd.exe win +style title "my computer" 0x00C0000 |
设置我的电脑窗口为从右至左的顺序(适用于希伯来语和阿拉伯语) |
nircmd.exe win +exstyle title "my computer" 0x00400000 |
设置我的电脑窗口的所有子窗口为从右至左的顺序(适用同上) |
nircmd.exe win child title "my computer" +exstyle all 0x00400000 |
在桌面创建可以关闭所有IE窗口的快捷方式 |
nircmd.exe cmdshortcut " "~$folder.desktop$ "Close All IE" win close class "IEFrame" |
在桌面创建可以隐藏所有IE窗口的快捷方式 |
nircmd.exe cmdshortcut " "~$folder.desktop$ "Hide All IE" win hide class "IEFrame" |
在桌面创建可以再次显示所有IE窗口的快捷方式 |
nircmd.exe cmdshortcut " "~$folder.desktop$ "Show All IE" win show class "IEFrame" |
把calculator窗口设置为最上层窗口(在其他窗口之上) |
nircmd.exe win settopmost title "Calculator" 1 |
恢复calculator窗口为原始窗口状态(不处于最上层) |
nircmd.exe win settopmost title "Calculator" 0 |
创建calc.exe快捷方式到开始菜单->程序->Calculators |
nircmd.exe shortcut "f:\winnt\system32\calc.exe" "~$folder.programs$\Calculators" "Windows Calculator" |
隐藏桌面所有图标 |
nircmd.exe win hide class progman |
显示桌面所有图标(用以上命令隐藏过后) |
nircmd.exe win show class progman |
隐藏系统开始按钮 |
nircmd.exe win child class "Shell_TrayWnd" hide class "button" |
显示系统开始按钮 |
nircmd.exe win child class "Shell_TrayWnd" show class "button" |
隐藏系统时间 |
nircmd.exe win child class "Shell_TrayWnd" hide class "TrayClockWClass" |
显示系统时间 |
nircmd.exe win child class "Shell_TrayWnd" show class "TrayClockWClass" |
终止所有IE实例 |
nircmd.exe killprocess iexplore.exe |
创建桌面快捷方式,运行即可弹出光驱(K盘) |
nircmd.exe cmdshortcut "~$folder.desktop$" "Open CDROM" cdrom open k: |
将nirsoft网址创建到桌面快捷方式 |
nircmd.exe urlshortcut "http://www.nirsoft.net" "~$folder.desktop$" "NirSoft" |
添加nirsoft网址到收藏夹\链接下 |
nircmd.exe urlshortcut "http://www.nirsoft.net" "~$folder.favorites$\Links" "NirSoft" |
将nirsoft网址快捷方式创建到computers.txt中列出的所有计算机的桌面 |
nircmd.exe multiremote copy "c:\temp\computers.txt" urlshortcut "http://www.nirsoft.net" "~$folder.common_desktop$" "NirSoft" |
设置显示模式为800X600,24位色 |
nircmd.exe setdisplay 800 600 24 |
将设置显示模式为800X600,24位色命令创建为桌面快捷方式 |
nircmd.exe cmdshortcut "~$folder.desktop$" "800x600x24" setdisplay 800 600 24 |
复制所有桌面快捷方式到其他文件夹(f:\temp\desktop) |
nircmd.exe execmd copy "~$folder.desktop$\*.lnk" f:\temp\desktop |
重启你的Apache server服务器(windows NT/2000/XP/2003) |
nircmd.exe service restart apache |
将重启Apache server服务器命令创建为桌面快捷方式 |
nircmd.exe cmdshortcut "~$folder.desktop$" "Restart Apache" service restart apache |
重启IIS(互联网信息服务) |
nircmd.exe service restart w3svc |
重启MySql |
nircmd.exe service restart MySql |
打开指定注册表项/值 |
nircmd.exe regedit "HKLM\Software\Microsoft\Windows\CurrentVersion" "CommonFilesDir" |
打开你在注册表编辑器中复制到剪切板的注册表项 |
nircmd regedit "~$clipboard$" |
禁用屏保 |
nircmd.exe regsetval sz "HKCU\control panel\desktop" "ScreenSaveActive" 0 |
取消禁用屏保 |
nircmd.exe regsetval sz "HKCU\control panel\desktop" "ScreenSaveActive" 1 |
改变指定文件的日期/时间(创建时间和修改时间) |
nircmd.exe setfiletime "c:\temp\myfile.txt" "24-06-2003 17:57:11" "22-11-2005 10:21:56" |
复制桌面所在路径到剪切板 |
nircmd.exe clipboard set ~$folder.desktop$ |
复制开始菜单文件夹路径到剪切板 |
nircmd.exe clipboard set ~$folder.start_menu$ |
复制文本info1.txt中的内容到剪切板 |
nircmd.exe clipboard readfile "c:\My Files\info1.txt" |
将剪切板中内容添加到文本info1.txt中 |
nircmd.exe clipboard addfile "c:\My Files\info1.txt" |
清空剪切板 |
nircmd.exe clipboard clear |
创建所有在"c:\temp\folders.txt"中指定的文件夹,文件夹路径名用回车符隔开 |
nircmd.exe paramsfile "c:\temp\folders.txt" "" "" execmd md ~$fparam.1$ |
安装所有在全局程序集缓存(GAC)中指定的.NET程序集 |
nircmd.exe gac install "C:\temp\MyAssembly\bin\MyAssembly.dll" |
清空所有磁盘上的回收站 |
nircmd.exe emptybin |
对一个标准的Windows信息框回复确认 |
nircmd.exe dlg "" "" click yes |
延迟2秒钟,然后保存当前屏幕截图到shot.png |
nircmd.exe cmdwait 2000 savescreenshot "f:\temp\shot.png" |
Open the door of J: CD-ROM drive | nircmd.exe cdrom open j: |
Close the door of Y: CD-ROM drive | nircmd.exe cdrom close y: |
Speaks the text currently in the clipboard (For Windows XP/Vista/7/8). | speak text ~$clipboard$ |
Speaks the text stored inside speak.txt into speak.wav filename (For Windows XP/Vista/7/8). | speak file "c:\temp\speak.txt" 0 100 "c:\temp\speak.wav" 48kHz16BitStereo |
Increase the system volume by 2000 units (out of 65535) | nircmd.exe changesysvolume 2000 |
Decrease the system volume by 5000 units (out of 65535) | nircmd.exe changesysvolume -5000 |
Set the volume to the highest value | nircmd.exe setsysvolume 65535 |
Mute the system volume | nircmd.exe mutesysvolume 1 |
Unmute the system volume | nircmd.exe mutesysvolume 0 |
Switch the system volume between the mute and normal state. | nircmd.exe mutesysvolume 2 |
Create a shortcut on your desktop that switch the system volume between the mute and normal state. | nircmd.exe cmdshortcut "~$folder.desktop$" "Switch Volume" mutesysvolume 2 |
Turn off the monitor | nircmd.exe monitor off |
Start the default screen saver | nircmd.exe screensaver |
Put your computer in 'standby' mode | nircmd.exe standby |
log off the current user | nircmd.exe exitwin logoff |
Ask if you want to reboot, and if you answer 'Yes', reboot the computer. | nircmd.exe qboxcom "Do you want to reboot ?" "question" exitwin reboot |
Turn off your computer | nircmd.exe exitwin poweroff |
Turn off all computers specified in computers.txt ! | multiremote copy "c:\temp\computers.txt" exitwin poweroff force |
Dial to "My Internet" connection | nircmd.exe rasdial "My Internet" |
Disconnect the "My Internet" connection | nircmd.exe rashangup "My Internet" |
Make your Internet Explorer windows 75% transparent ! (192 / 256) | nircmd.exe win trans ititle "internet explorer" 192 |
Minimize all your Internet Explorer windows | nircmd.exe win min class "IEFrame" |
Close all your Internet Explorer windows | nircmd.exe win close class "IEFrame" |
Close all your Explorer windows (My Computer, folders, and so on) | nircmd.exe win close class "CabinetWClass" |
Hide all your Internet Explorer windows | nircmd.exe win hide class "IEFrame" |
Show all your Internet Explorer windows (after you made them hidden with previous example) | nircmd.exe win show class "IEFrame" |
Center all top-level windows | nircmd.exe win center alltop |
Remove the title bar of My Computer window. | nircmd.exe win -style title "my computer" 0x00C00000 |
Return the title bar of My Computer window that we removed in the previous example. | nircmd.exe win +style title "my computer" 0x00C00000 |
Set the My Computer window to right-to-left order (For hebrew and arabic languages) | nircmd win +exstyle title "my computer" 0x00400000 |
Set all child windows of My Computer window to right-to-left order (For hebrew and arabic languages) | nircmd win child title "my computer" +exstyle all 0x00400000 |
Create a shortcut on your desktop that closes all your Internet Explorer windows | nircmd.exe cmdshortcut " "~$folder.desktop$ "Close All IE" win close class "IEFrame" |
Create a shortcut on your desktop that hides all your Internet Explorer windows | nircmd.exe cmdshortcut " "~$folder.desktop$ "Hide All IE" win hide class "IEFrame" |
Create a shortcut on your desktop that shows back all your Internet Explorer windows | nircmd.exe cmdshortcut " "~$folder.desktop$ "Show All IE" win show class "IEFrame" |
Set the Windows Calculator as top-most window (above all other windows) | nircmd.exe win settopmost title "Calculator" 1 |
Set the Windows Calculator back to regular window (non top-most window) | nircmd.exe win settopmost title "Calculator" 0 |
Create a shortcut to Windows calculator under Start Menu->Programs->Calculators | nircmd.exe shortcut "f:\winnt\system32\calc.exe" "~$folder.programs$\Calculators" "Windows Calculator" |
Hide the desktop window | nircmd.exe win hide class progman |
Show the desktop window (After hiding it in previous example) | nircmd.exe win show class progman |
Hide the start button on the system tray | nircmd.exe win child class "Shell_TrayWnd" hide class "button" |
Show the start button on the system tray | nircmd.exe win child class "Shell_TrayWnd" show class "button" |
Hide the clock on the system tray | nircmd.exe win child class "Shell_TrayWnd" hide class "TrayClockWClass" |
Show the clock on the system tray | nircmd.exe win child class "Shell_TrayWnd" show class "TrayClockWClass" |
Kill (terminate) all instance of Internet Explorer processes | nircmd.exe killprocess iexplore.exe |
Create a shortcut on your desktop that opens the door of K: CDROM drive when you run it. | nircmd.exe cmdshortcut "~$folder.desktop$" "Open CDROM" cdrom open k: |
Create a shortcut to NirSoft Web site on your desktop | nircmd.exe urlshortcut "http://www.nirsoft.net" "~$folder.desktop$" "NirSoft" |
Add NirSoft Web site to your Favorities under Links folder. | nircmd.exe urlshortcut "http://www.nirsoft.net" "~$folder.favorites$\Links" "NirSoft" |
Create a shortcut to NirSoft Web site on the desktop of all computers listed in computers.txt | nircmd.exe multiremote copy "c:\temp\computers.txt" urlshortcut "http://www.nirsoft.net" "~$folder.common_desktop$" "NirSoft" |
Set the display mode to 800x600x24bit colors | nircmd.exe setdisplay 800 600 24 |
Create a shortcut on the desktop that set the display mode to 800x600x24bit colors | nircmd.exe cmdshortcut "~$folder.desktop$" "800x600x24" setdisplay 800 600 24 |
Copy all shortcuts on your desktop to another folder (f:\temp\desktop). | nircmd.exe execmd copy "~$folder.desktop$\*.lnk" f:\temp\desktop |
Restart your Apache server (under Windows NT/2000/XP/2003) | nircmd.exe service restart apache |
Create a shortcut on your desktop that restarts the Apache server | nircmd.exe cmdshortcut "~$folder.desktop$" "Restart Apache" service restart apache |
Restart your IIS | nircmd.exe service restart w3svc |
Restart MySql | nircmd.exe service restart MySql |
Open the desired Registry key/value in RegEdit | nircmd.exe regedit "HKLM\Software\Microsoft\Windows\CurrentVersion" "CommonFilesDir" |
Open the Registry key that you copied to the clipboard in RegEdit. | nircmd regedit "~$clipboard$" |
Disable the screen saver | nircmd.exe regsetval sz "HKCU\control panel\desktop" "ScreenSaveActive" 0 |
Enable the screen saver | nircmd.exe regsetval sz "HKCU\control panel\desktop" "ScreenSaveActive" 1 |
Change the date/time of the specified filename (creation time and modified time) | nircmd.exe setfiletime "c:\temp\myfile.txt" "24-06-2003 17:57:11" "22-11-2005 10:21:56" |
Copy your desktop folder path to the clipboard | nircmd.exe clipboard set ~$folder.desktop$ |
Copy your start menu folder path to the clipboard | nircmd.exe clipboard set ~$folder.start_menu$ |
Copy the content of info1.txt (simple text file) to the clipboard | nircmd.exe clipboard readfile "c:\My Files\info1.txt" |
Add the text content of clipboard to info1.txt | nircmd.exe clipboard addfile "c:\My Files\info1.txt" |
Clear the clipboard | nircmd.exe clipboard clear |
Create all folders specified in "c:\temp\folders.txt". The folder path names are separated by CRLF characters. | nircmd.exe paramsfile "c:\temp\folders.txt" "" "" execmd md ~$fparam.1$ |
Install the specified .NET assembly in the global assembly cache (like gacutil) | nircmd.exe gac install "C:\temp\MyAssembly\bin\MyAssembly.dll" |
Empty the recycle bin in all drives. | nircmd.exe emptybin |
Answer 'Yes' to a standard Windows message-box. | nircmd.exe dlg "" "" click yes |
Wait 2 seconds, and then save the current screen to shot.png | nircmd.exe cmdwait 2000 savescreenshot "f:\temp\shot.png" |
Save 10 screenshots in a loop, and wait 60 seconds between the screenshot save calls. The filenames of the screenshot will contain the time and date of the saved screenshot. | nircmd.exe loop 10 60000 savescreenshot c:\temp\scr~$currdate.MM_dd_yyyy$-~$currtime.HH_mm_ss$.png |
Wait until Firefox is closed, and then say "Firefox was closed" | nircmd.exe waitprocess firefox.exe speak text "Firefox was closed" |
Run RegEdit with SYSTEM user (On Windows 7/8/Vista/2008), which allows you to view all hidden system Registry keys | nircmd.exe elevatecmd runassystem c:\windows\regedit.exe |
相关文章
NirCmd介绍
命令行工具(nircmd.exe)的使用方法