天天看點

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