Archive for the ‘command prompt tricks’ Category

Reboot a Remote Computer


shutdown -r -f -m \\remotePC -c “System will be rebooted in 20 seconds”

Sometimes, you just need to reboot a system. This will do it remotely and give the user a 20 second warning.

Tip : To open Command Prompt, click Start, click Run, type cmd, and then click OK.

Advertisements

Kill A Program


taskkill /im programname.exe /f

If, when using the tasklist command, you discover that there is something running you just want killed. This is the way to do it! Just note the program name and use it in place of programname.exe.

List All Tasks Running On The Computer


List All Tasks Running On The Computer

tasklist

It’s always good to know what is running on your system. This is the command line version of the processes tab in Taks Manager.

Map A Drive Letter to a Folder


subst W: C:\windows

Sometimes, your directory structure can get pretty deep and complicated. You can simplify this a bit by mapping a drive letter to commonly used folders. In the example that I have given, this will create a drive letter W: and map it to the C:\windows directory. Then, whenever you go into My Computer, you will see a W: drive and when you browse to it, it will automatically take you to the contents of the C:\windows folder.

You can do this with any unused drive letter and any folder that exists on your system.

Automatically Defragment C: Daily


schtasks /create /tn “Defrag C” /tr “defrag c: /f” /sc daily /st 23:00:00 /ru “System”

This will set your computer to automatically perform a complete defrag of the C: drive each day at 11:00:00 PM (23:00:00). It does this by creating a scheduled task called Defrag C. It will run this command under the computer’s system account.

Retrieve Detailed System Information


systeminfo

With this command, you can retrieve the following information:

Host Name
OS Name
OS Version
OS Manufacturer
OS Configuration
OS Build Type
Registered Owner
Registered Organization
Product ID
Original Install Date
System Up Time
System Manufacturer
System Model
System type
Processor(s)
BIOS Version
Windows Directory
System Directory
Boot Device
System Locale
Input Locale
Time Zone
Total Physical Memory
Available Physical Memory
Virtual Memory Max Size
Virtual Memory Available
Virtual Memory In Use
Page File Location(s)
Domain
Logon Server
Hotfix(s)
NetWork Card(s)

Defragment Remote Computer


rexec remotePC defrag C: /F

This command used the rexec command to force a defragment of the C: drive on the computer named remotePC. You can use whatever you want to for the command (I just used defrag C: /F as an example). This is very useful for remote maintenance.