Coder Profile - Show off your skills, get a coder profile.
 
 
 
Command Line and Batch Files: The Basics
Operating Systems
If you have been on the computer for a while, since Windows 95, then you should definitely know how to use command line! It comes in really handly when you want to start automating programs and tasks, such as performancing logging, or maybe you are trying to troubleshoot networking problems.

Here are some basics to get you started on learning some simple commands for command line that could save your sanity.

Start up command prompt by click on Start -> Run -> cmd

If you want to learn about any really basic commands in the prompt, just simply type 'help' and it will populate a nice list of commands. These commands are useful for doing IO (or file) operations, but will not help you for doing things like automating. For doing batch commands like 'net' or 'ipconfig', you need to know the command in order to use it.

For reference on all the standard batch command for A-Z, visit Microsoft's handy webpage: http://technet2.microsoft.com/WindowsServer/en/library/552ed70a-208d-48c4-8...

So, you may ask yourself sometimes, what is my IP Addres?
Well, it's quite simple to figure that out with the command prompt. Simply type in 'ipconfig' and you will get a couple lines of information. On XP, you will get your default domain, IP Address, subnet and default gateway. These are all helpful. In Vista, you get quite a bit more with the addition of IPv6 addresses.

What is the name, or hostname, of my computer?
Type in 'hostname'

If you are on a network with a domain, the following command will save your life at times. It gives you all the necessary commands to see what the current configurations are on your network, computers you can see, time if a domain controller is setup, and many other things.

Type in 'net' and you can see the available list of options to choose from.

1. net start will show you a list of running network services
2. net stop will allow you to stop some network services
3. net view will show you a list of connected computers/devices
4. net time will show you the network time of a domain controller
5. net use will connect your computer to a computer and/or device
6. net print will show current print jobs and queue's, if you are connected to a print server

These are just the basic's of net. To see more help or syntaxies on each command, just simply type 'net command /help' (Ex: net use /help)

Performance Logs
Windows Performance Manager can be accessed via command line as well through the logman command. You are able to start, stop, create and query counters from the command. To find more information on it and how to use it, type 'logman /?'

Batch Files:
Batch files allow you to run command line commands through it. Batch files are nice because they let you run multiple commands at one time, and automating them are very easy with this.

Example of a batch file:
CODE: Copy / Restore  ::  Remove Scroll Bars
  1. @echo off
  2. echo This is a batch file, now let's run some commands
  3. hostname
  4. ipconfig
  5. pause
Above, you will notice the @echo off line. This makes it so when you run a command, it doesn't show it being "typed" in. In otherwords, you know it will show that command, so you don't want to see it again, just the output of the command.

After that you can print out text to the window by issuing the echo command and then the text. Anywhere on, you can do your commands.

In order to keep the window opened after it is done running the commands, you need to put a 'puase' at the end, so in order for the window to close, you have to "press any button to continue...".

These are the basics you would need to know to start learning how to use the command line and use batch files. Hope this helps you!


Posted By Izzmo
Please login to rate coding articles.

Click here to register a free account with us.
Comments
Please login to post comments.
 
shadytyrant     Posted 20 Days Ago
 
 
Nice job, if you know the command prompt and how to use it then you basically know
most of batch code. Good tutorial on automation.
Page 1 of 1
More Articles By This Author
Command Line and Batch Files: The Basics
Another way to disable the UAC in Windows Vista
Recently Posted "Operating Systems" Articles
Windows Start Up Button Tweak
Command Line and Batch Files: The Basics
Another way to disable the UAC in Windows Vista
Various methods for Disabling UAC on Vista
Recently Rated "Operating Systems" Articles
Command Line and Batch Files: The Basics
Another way to disable the UAC in Windows Vista
Various methods for Disabling UAC on Vista
Windows Start Up Button Tweak
source codes Categories articles
Browse All
Business & E-Commerce (1)
Databases (1)
Design & Creativity (1)
Internet & Web Sites (1)
Life In General (2)
Networking (1)
Operating Systems (4)
Other (2)
Programming (51)
Security (10)
Software Development (5)
Standards (1)
Web Development (15)
search Search Inside
Operating Systems
 
 
Latest News About Coder Profile
Coder Profile Poll
What would you rate the design of Coder Profile?

9 to 10
7 to 8
5 to 6
3 to 4
1 to 2


please login to cast your vote
and see the results of this poll
Latest Coder Profile Changes
Coder Profile was last updated
5 Days Ago
Official Blog :: Make A Donation :: Credits :: Contact Me
Terms & Conditions :: Privacy Policy :: Documents :: Wallpapers
Version 1.46.00
Copyright © 2007 - 2008, Scott Thompson, All Rights Reserved