WildlandsTech
Comprehensive List of NirCmd Commands with Descriptions - Printable Version

+- WildlandsTech (https://wildlandstech.com)
+-- Forum: Programming (https://wildlandstech.com/forumdisplay.php?fid=3)
+--- Forum: Batch & Shell Scripting (https://wildlandstech.com/forumdisplay.php?fid=42)
+--- Thread: Comprehensive List of NirCmd Commands with Descriptions (/showthread.php?tid=140)



Comprehensive List of NirCmd Commands with Descriptions - Sneakyone - 09-03-2024

Comprehensive List of NirCmd Commands with Descriptions

NirCmd is a versatile command-line tool that enables you to automate a wide range of system tasks. Below is a comprehensive list of NirCmd commands with descriptions and examples.



1. mutesysvolume
Description: Mutes or unmutes the system volume.
Code:
nircmd.exe mutesysvolume 1  ; Mutes the system volume
nircmd.exe mutesysvolume 0  ; Unmutes the system volume
nircmd.exe mutesysvolume 2  ; Toggles the mute state

2. changesysvolume
Description: Changes the system volume by a specified amount.
Code:
nircmd.exe changesysvolume 5000  ; Increases the volume
nircmd.exe changesysvolume -5000 ; Decreases the volume

3. setsysvolume
Description: Sets the system volume to a specific level.
Code:
nircmd.exe setsysvolume 65535  ; Sets volume to maximum
nircmd.exe setsysvolume 32767  ; Sets volume to 50%

4. setbrightness
Description: Sets the screen brightness to a specific level.
Code:
nircmd.exe setbrightness 50  ; Sets brightness to 50%
nircmd.exe setbrightness 100 ; Sets brightness to 100%

5. monitor
Description: Turns the monitor on, off, or puts it into low-power mode.
Code:
nircmd.exe monitor off      ; Turns the monitor off
nircmd.exe monitor on        ; Turns the monitor on
nircmd.exe monitor lowpower  ; Puts the monitor in low-power mode

6. screensaver
Description: Starts the screensaver.
Code:
nircmd.exe screensaver

7. lockws
Description: Locks the workstation (equivalent to pressing Win+L).
Code:
nircmd.exe lockws

8. exitwin
Description: Shuts down, restarts, logs off, or locks the computer.
Code:
nircmd.exe exitwin poweroff  ; Shuts down the computer
nircmd.exe exitwin reboot    ; Restarts the computer
nircmd.exe exitwin logoff    ; Logs off the current user
nircmd.exe exitwin lock      ; Locks the workstation

9. clipboard
Description: Manipulates the clipboard content.
Code:
nircmd.exe clipboard saveclip "C:\path\to\clipboard.txt"  ; Saves clipboard content to a text file
nircmd.exe clipboard clear                                ; Clears the clipboard
nircmd.exe clipboard copyfile "C:\path\to\file.txt"      ; Copies a file to the clipboard

10. setdefaultsounddevice
Description: Sets the default sound device.
Code:
nircmd.exe setdefaultsounddevice "Speakers"  ; Sets "Speakers" as the default sound device
nircmd.exe setdefaultsounddevice "Headphones"  ; Sets "Headphones" as the default sound device

11. win
Description: Manipulates windows (minimize, maximize, close, etc.).
Code:
nircmd.exe win close title "Untitled - Notepad"  ; Closes the Notepad window with the title "Untitled - Notepad"
nircmd.exe win minimize class "Notepad"          ; Minimizes all Notepad windows
nircmd.exe win maximize ititle "Document"        ; Maximizes the first window with "Document" in the title

12. elevatecmd
Description: Runs a command with elevated privileges (Administrator).
Code:
nircmd.exe elevatecmd exec hide "cmd.exe" "/c echo Hello, World!"

13. loop
Description: Repeats a command multiple times with a specified delay between each repetition.
Code:
nircmd.exe loop 10 1000 beep ; Beeps 10 times with a 1-second delay between each beep

14. speak
Description: Converts text to speech and plays it through the speakers.
Code:
nircmd.exe speak text "Hello, this is NirCmd speaking."

15. beep
Description: Generates a beep sound.
Code:
nircmd.exe beep 750 300  ; Beeps at 750 Hz for 300 milliseconds

16. savescreenshot
Description: Captures a screenshot and saves it as an image file.
Code:
nircmd.exe savescreenshot "C:\path\to\screenshot.png"

17. setcursor
Description: Sets the mouse cursor position on the screen.
Code:
nircmd.exe setcursor 500 300  ; Moves the cursor to the coordinates (500, 300)

18. sendkey
Description: Simulates a key press.
Code:
nircmd.exe sendkey ctrl+alt+del press ; Simulates pressing Ctrl+Alt+Del
nircmd.exe sendkey enter press        ; Simulates pressing the Enter key

19. waitprocess
Description: Waits until a specified process is terminated.
Code:
nircmd.exe waitprocess notepad.exe

20. elevate
Description: Runs a command with elevated privileges (Administrator) without showing a UAC prompt.
Code:
nircmd.exe elevate setvol master 65535  ; Sets the master volume to maximum with elevated privileges

21. hideapp
Description: Hides or shows an application window.
Code:
nircmd.exe hideapp hide process notepad.exe  ; Hides all Notepad windows
nircmd.exe hideapp show process notepad.exe  ; Shows all Notepad windows

22. execmd
Description: Executes a command line in a hidden window.
Code:
nircmd.exe execmd cmd /c echo Hello, World! > C:\path\to\output.txt

23. regedit
Description: Executes a .reg file to import or export registry settings.
Code:
nircmd.exe regedit "C:\path\to\file.reg"  ; Executes the specified .reg file

24. net
Description: Executes network-related commands (similar to Windows `net` command).
Code:
nircmd.exe net start "ServiceName"  ; Starts a Windows service
nircmd.exe net stop "ServiceName"  ; Stops a Windows service

25. wait
Description: Pauses execution for a specified number of milliseconds.
Code:
nircmd.exe wait 5000  ; Waits for 5 seconds



Conclusion

NirCmd is a powerful tool for automating and controlling various aspects of the Windows operating system. By mastering these commands, you can create scripts to perform tasks ranging from