Skip to main content

Windows Command Line


Battery Test

WMIC PATH Win32_Battery Get EstimatedChargeRemaining Or powercfg /batteryreport /OUTPUT "c:\Adm...

Check the state of Windows Activation

slmgr.vbs /xpr   Typical Output:

Windows Command Line Firewall Commands

To Turn Off: NetSh Advfirewall set allprofiles state off NetSh Advfirewall set domainpr...

Copy files with permissions

xcopy x:*.* y:*.* /D /E /C /F /H /K /O /Y

Find All Domain Controllers

To be run from an elevated prompt Command Line: nltest /dclist:{Full Domain Name} PowerShell ...

Disable IPV6

Commands to disable IPV6 netsh interface teredo set state disabled netsh interface ipv6 6to4 se...

Disable LLMNR

From and elevated Command Line REG ADD “HKLM\Software\policies\Microsoft\Windows NT\DNSClient”...

Find Public IP from Command Line

nslookup myip.opendns.com resolver1.opendns.com

Get WiFi Password

List all known WiFi Networks   netsh wlan show profiles Show password for a known WiFi Netwo...

Lock Computer

rundll32.exe user32.dll,LockWorkStation

Map a drive as a different user

Map a drive net use y: \\server-1\cpas /USER:server-1\famme @TimeSheets /PERSISTENT:YES Delete ...

Windows Memory Information

For Total Physical Memory wmic ComputerSystem get TotalPhysicalMemory For Available Physical Me...

Stop Windows from Sleeping

powercfg -change -standby-timeout-ac 0

Rebuild Windows Search Database

This is a CMD file and when run stop the Windows Search and force a rebuild of the database. sc ...

Remove Corrupted Recycle Bin

Run from an elevated Command Line rd /s /q C:\$Recycle.Bin

Time Zone Commands

List All Time Zones tzutil /l List Current Time Zone tzutil /g Set Time Zone tzu...

Sudo for Windows

The attached CMD files can be called to force another application to run with administrator right...

Turn on the Windows Admin Share

This is executed from an elevated Command Line REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVe...

Turn on File/Folder Inheritance

The code snippet below turns on File/Folder inheritance recursively from the current position Th...

Unexpected Shutdown Message will not go away

This occurs when the Dirty Shutdown flag in Windows does not go away and displays the dialog ever...

Update Microsoft Office without a Windows Online Username

This will initiate the update of Microsoft Office without logging into Microsoft These commands ...

Windows Computer Uptime

Both of these commands will display the uptime for the current computer systeminfo | find "Syste...

Display Windows License Information

Run from Command Line slmgr -dli

Change Windows DNS

Show the current configuration netsh interface ip show config Set the Static DNS netsh interfa...

Domain Controllers Sync Password Reset

Command netdom resetpwd /s:{servername} /ud:{Username} /pd:* Example netdom resetpwd /s:wrsi-a...

Windows Offline Files

The two command files attached are for turning Off or On Offline Files in Windows. These should ...

Windows 10 Hide Shutdown, Restart, Sleep links

Run from an Elevated Command Prompt Hide Shutdown Links REG ADD HKLM\SOFTWARE\Microsoft\PolicyM...

Map Network Drive - Command Line

Example of mapping a drive from the command line net use m: \\server01\share Example of mapping...

Microsoft Word won't close (Windley Ely)

This is caused by residue from Wordox Remove the offensive file with the following del c:\USers...

Robocopy - Move files older than 60 days to archive folder

This line of code will move files from c:\temp to c:\temparchive that are older than 60 days. It ...

Robocopy - Move only files under 60 days old

This line of code will move files from c:\temp to c:\temparchive that are less than 60 days old. ...

Inject Product Key to Server 2019 after install

To activate or inject a product key in Microsoft Windows Server 2019.Enter this code in an elevat...

Switch Windows Terminal Services to Install Mode

To Switch Terminal Services to Install Mode When you want to add or remove programs, or change s...

Enable Remote Desktop From Command line in Windows

This guide will teach you the steps to use Command Prompt to enable or disable Remote Desktop and...

How to Determine Which Version of Microsoft .NET Framework Installed

To check what version of .Net installed on the machine, follow steps below: From the Command Lin...

Change Windows Computer Name

Change Computer Name using PowerShell From an elevated PowerShell enter the following PowerShell...

Local User Accounts

User Commands net user /add [*username] [password] net user /delete [username] {/domain} Note...

Time Sync Settings

This article gives the commands to set the Time Authority and runs a sync for the Windows Clock ...

Scheduled Tasks - Reboot machine One Time

From an elevated Command Line schtasks /create /TN "Reboot Machine" /TR "C:\Windows\System32\shu...

Disable LLMNR

From and elevated Command Line REG ADD “HKLM\Software\policies\Microsoft\Windows NT\DNSClient” ...