Windows Command Line Tutorial - Managing Windows from Command Prompt
Managing Windows using Command Line Interface - Using Batch Files in Windows
A batch file is normally a text file with Windows Command Line commands. It has to carry an extension .bat. Filename can be anything you wish.
You may see autoexec.bat in Windows drive -> root folder. Autoexec means automatic running of the commands contained in the batch file. This file executes all commands between Windows booting and Welcome Screen. Normally, the autoexec.bat is an empty file. You may use it to create your own maintenance system. If you do not wish to delay the process of Windows startup, you can create a batch file with any other name and run it later.
A batch file can be created for any purpose. All you need is sound knowledge of Windows Command Line commands and Notepad. There are some special batch file commands that help you create a perfect maintenance program.
We will create a simple batch file to clean the C drive as the computer starts:
1 Hit Windows key and then the R key on your keyboard. Type Notepad in Run Dialog and hit Enter to open Notepad.
2. As we intend to delete all junk files from the C drive, we will save it in the root directory. Press CTRL +S and in the Save as Dialog, type C:\CleanJunk.bat. Make sure that in the Save As Type box, you select All Files (*.*) else it will be saved as a text file.
3. Type Del C:\*.tmp /S as the first line in the Notepad and hit Enter for next line. Refer to the Windows Command Line Guide, Part I, for information on Del command.
4. Type Del C:\*.log /S in the second line.
5. Save and close the file.
Our batch file is ready. The /S option checks each subfolder in C drive’s root folder - meaning, all folders will be scanned.
To run the batch file, all you need to do is to open the C drive and double click on the CleanJunk.bat file. To run it from RUN, type C:\CleanJunk to run the file. As the file runs, it scans all root and subfolders for .tmp files and deletes them. Then it comes to the second command and repeats the process for all .log files.
This is just a simple batch file that cleans your C drive. You can create a batch file - of any complexity - to maintain Windows and thereby automate and speed up computer tasks.
Windows Command Line Commands - Running Windows Applications for Maintenance
[A] GPEDIT.MSC: The command is used to configure group policies and place restrictions on different Windows components. The command is NOT available for Windows Home version.
[B] SYSKEY: The command launches Windows Security System Tool. This tool allows you to enable or disable encryption to Windows Account Database.
[C] WSCRIPT: Opens the Windows Script Host Settings Dialog where you can set a time limit so that it stops Windows logon and logoff scripts if they cross the time limit.
[D] wmimgmt.msc: Opens the Microsoft Management Infrastructure Window. This helps you add, manage and remove different snap-ins to the Management Console. These include security settings, administration settings, and more.
[E] MSIEXEC: When used as such, opens the Windows Installer details. You can use the Windows Command Line command to install any program (compatible with Windows) with different privileges.
Usage: msiexec InstallationPackageName [Optional Parameters]
The optional parameters include /A, /J:M or /J:U. If /A is used, you can install the product for the entire network. If /J:M is used, the product is installed for all users of the computer while /J:U installs the product for current user only.
The command allows you greater control over the machine or network as against normal (GUI) installations. Please use the command only and only if you have good knowledge about product installations.
The list of Windows Command Line commands is endless. Mostly, these commands are used by developers and technicians to fix Windows problems. Others use simple Windows Command Line commands to speed up computer tasks.
Disclaimer: Please create a restore point before using the above commands. The author and Bright Hub are not responsible for any problems arising due to improper usage of these commands.