Command prompts for Windows
commands Useful commands Windows TipsCommand prompts for Windows
Some of these command below can cause harmful an undesirable functions, leading to the formatting of your hard disk and data loss, while others will not run under Windows XP. As for Windows Vista the Run Tab is not visible in the start up menu. Windows Vista specific command prompts are not included.
Feel free to add any additional information and tips, you think necessary.
Here is a list of commands you can use under Microsoft Windows prearranged depending of their functionality :
- Control Panel
- Windows utility and applications
- Disk management
- Connection management
- Miscellaneous commands
Control Panel
- CONTROL: opens the control panel window
- CONTROL ADMINTOOLS: opens the administrative tools
- CONTROL KEYBOARD: opens keyboard properties
- CONTROL COLOUR: opens display properties.Appearance tab
- CONTROL FOLDERS: opens folder options
- CONTROL FONTS: opens font policy management
- CONTROL INTERNATIONAL or INTL.CPL: opens Regional and Language option
- CONTROL MOUSE or MAIN.CPL: opens mouse properties
- CONTROL USERPASSWORDS: opens User Accounts editor
- CONTROL USERPASSWORDS2 or NETPLWIZ: User account access restrictions
- CONTROL PRINTERS: opens faxes and printers available
- APPWIZ.CPL: opens Add or Remove programs utility tool
- OPTIONALFEATURES: opens Add or Remove Windows component utility
- DESK.CPL: opens display properties. Themes tab
- HDWWIZ.CPL: opens add hardware wizard
- IRPROPS.CPL: infrared utility tool
- JOY.CP: opens game controllers settings
- MMSYS.CPL: opens Sound and Audio device Properties. Volume tab
- SYSDM.CPL: opens System properties
- TELEPHON.CPL: Opens phone and Modem options
- TIMEDATE.CPL: Date and Time properties
- WSCUI.CPL: opens Windows Security Center
- ACCESS.CPL: opens Accessibility Options
- WUAUCPL.CPL: opens Automatic Updates
- POWERCFG.CPL: opens Power Options Properties
- AZMAN.MSC: opens authorisation management utility tool
- CERTMGR.MSC: opens certificate management tool
- COMPMGMT.MSC: opens the Computer management tool
- COMEXP.MSC or DCOMCNFG: opens the Computer Services management tool
- DEVMGMT.MSC: opens Device Manager
- EVENTVWR or EVENTVWR.MSC: opens Event Viewer
- FSMGMT.MSC: opens Shared Folders
- NAPCLCFG.MSC: NAP Client configuration utility tool
- SERVICES.MSC: opens Service manager
- TASKSCHD.MSC or CONTROL SCHEDTASKS: opens Schedule Tasks manager
- GPEDIT.MSC: opens Group Policy utility tool
- LUSRMGR.MSC: opens Local Users and Groups
- SECPOL.MSC: opens local security settings
- CIADV.MSC: opens indexing service
- NTMSMGR.MSC: removable storage manager
- NTMSOPRQ.MSC: removable storage operator requests
- WMIMGMT.MSC: opens (WMI) Window Management Instrumentation
- PERFMON or PERFMON.MSC: opens the Performance monitor
- MMC: opens empty Console
- MDSCHED: opens memory diagnostics tools
- DXDIAG: opens DirectX diagnostics tools
- ODBCAD32: opens ODBC Data source Administrator
- REGEDIT or REGEDT32: opens Registry Editor
- DRWTSN32: opens Dr. Watson
- VERIFIER: opens Driver Verifier Manager
- CLICONFG: opens SQL Server Client Network Utility
- UTILMAN: opens Utility Manager
- COLORCPL: opens color management
- CREDWIZ: back up and recovery tool for user passwords
- MOBSYNC: opens Synchronization center
- MSCONFIG: opens System Configuration Utility
- SYSEDIT: opens System Configuration Editor (careful while using this command)
- SYSKEY: Windows Account Database Security management (careful while using this command)
Windows utility and applications
- EPLORER: Opens windows Explorer
- IEXPLORER: Opens Internet explorer
- WAB: opens Contacts
- CHARMAP: opens Character Map
- WRITE: opens WordPad
- NOTEPAD: opens Notepad
- CALC: opens Calculator
- CLIPBRD: opens Clipbook Viewer
- WINCHAT: opens Microsoft Chat Interface
- SOUNDRECORDER: opens sound recording tool
- DVDPLAY: run CD or DVD
- WMPLAYER: opens Windows Media Player
- MOVIEMK: Opens untitled Windows Movie Maker
- OSK: opens on-screen Keyboard
- MAGNIFY: opens Magnifier
- WINCAL: opens Calendar
- DIALER: opens phone Dialer
- EUDCEDIT: opens Private Character Editor
- NDVOL: opens the mixer volume
- RSTRUI : opens Tool System Restore (For Vista only)
- %WINDIR%\SYSTEM32\RESTORE\rstrui.exe: opens Tool System Restore (for XP only).
- MSINFO32: Opens the System Information
- MRT : launches the utility removal of malware.
- Taskmgr : Opens the Windows Task Manager
- CMD: opens a command prompt
- MIGWIZ: Opens the tool for transferring files and settings from Windows (Vista only)
- Migwiz.exe: Opens the tool for transferring files and settings from Windows (for XP only)
- SIDEBAR: Open the Windows (Vista only)
- Sigverif : Opens the tool for verification of signatures of files
- Winver : Opens the window for your Windows version
- FSQUIRT: Bluetooth Transfer Wizard
- IExpress opens the wizard for creating self-extracting archives. Tutorial HERE
- MBLCTR: opens the mobility center (Windows Vista only)
- MSRA : Opens the Windows Remote Assistance
- Mstsc : opens the tool connection Remote Desktop
- MSDT: opens the diagnostic tools and support Microsoft
- WERCON: opens the reporting tool and solutions to problems (for Vista only)
- WINDOWSANYTIMEUPGRADE: Enables the upgrade of Windows Vista
- WINWORD : opens Word (if installed)
- PRINTBRMUI : Opens migration wizard printer (Vista only)
Disk management
- DISKMGMT.MSC: opens disk management utility
- CLEANMGR: opens disk drive clean up utility
- DFRG.MSC: opens disk defragmenter
- CHKDSK: complete analysis of disk partition
- DISKPART: disk partitioning tool
Connection management
- IPCONFIG: list the configuration of IP addresses on your PC (for more information type IPCONFIG/? in the CMD menu)
- INETCPL.CPL: opens internet properties
- FIREWALL.CPL: opens windows firewall
- NETSETUP.CPL: opens network setup wizard
Miscellaneous commands
- JAVAWS: View the cover of JAVA software (if installed)
- AC3FILTER.CPL: Opens the properties AC3 Filter (if installed)
- FIREFOX: Mozilla launches Firefox (if installed)
- NETPROJ: allow or not connecting to a network projector (For Vista only)
- LOGOFF: closes the current session
- SHUTDOWN: shut down Windows
- SHUTDOWN-A: to interrupt Windows shutdown
- %WINDIR% or %SYSTEMROOT%: opens the Windows installation
- %PROGRAMFILES%: Opens the folder where you installed other programs (Program Files)
- %USERPROFILE%: opens the profile of the user currently logged
- %HOMEDRIVE%: opens the browser on the partition or the operating system is installed
- %HOMEPATH%: opens the currently logged user C: \ Documents and Settings \ [username]
- %TEMP%: opens the temporary folder
- VSP1CLN: deletes the cache for installation of the service pack 1 for Vista
- System File Checker (Requires Windows CD if the cache is not available):
- SFC / scannow: immediately scans all system files and repairs damaged files
- SFC / VERIFYONLY: scans only those files system
- SFC / Scanfil = "name and file path": scans the specified file, and repaired if damaged
- SFC / VERIFYFILE = "name and file path": Scans only the file specified
- SFC / scanonce: scans the system files on the next restart
- SFC / REVERT: return the initial configuration (For more information, type SFC /? In the command prompt CMD.
Debug a Windows XP batch file and output the current date and time to a log file
commands Useful commands Windows TipsTo run logtime, first download and install the Windows Server 2003 Resource Kit using the instructions mentioned in MalekTips (check the other Windows XP and DOS command tips).
Once the Resource Kit is installed, to view the online help for logtime:
C:\>logtime /?
To write a message to the text file "logtime.log" in the current directory, just issue this command:
C:\>logtime "MESSAGE"
For example, the following command will write the current day, time, and message "Command just completed" to the file logtime.log:
C:\>logtime "Command just completed"
Note that this will display the results of the command to the standard output as well. To hide this:
C:\>@logtime "Command just completed" > nul
XP: kill a Windows process from the command line with taskkill
commands Useful commands Windows TipsThe ability to perform tasks from a system’s command line allows those tasks to be used in batch files. This recipe describes several uses of taskkill to terminate Windows processes.
If you know the name of a process to kill, for example notepad.exe, use the following command from a command prompt to end it:
taskkill /IM notepad.exe
This will cause the program to terminate gracefully, asking for confirmation if there are unsaved changes. To forcefully kill the same process, add the /F option to the command line. Be careful with the /F option as it will terminate all matching processes without confirmation.To kill a single instance of a process, specify its process id (PID). For example, if the desired process has a PID of 827, use the following command to kill it:
taskkill /PID 827
Using filters, a variety of different patterns can be used to specify the processes to kill. For example, the following filter syntax will forcefully kill all processes owned by the user Quinn:
taskkill /F /FI “USERNAME eq Quinn”
The following table shows the available filters and their use.
Filter Name Valid Operators Valid Value(s)
———– ————— ————–
STATUS eq ne RUNNING | NOT RESPONDING
IMAGENAME eq ne Image name
PID eq ne gt lt ge le PID value
SESSION eq ne gt lt ge le Session number.
CPUTIME eq ne gt lt ge le CPU time in the format
of hh:mm:ss.
MEMUSAGE eq ne gt lt ge le Memory usage in KB
USERNAME eq ne User name in [domain\]user
format
MODULES eq ne DLL name
SERVICES eq ne Service name
WINDOWTITLE eq ne Window titleeq: equals ne: not equal
gt: greater than lt: less than
gt: greater than or equal le: less than or equal
WindowsXP: Using the Command prompt to see and kill processes
commands Useful commands Windows TipsAs my project work requires writing and running codes, I generally have at least one Windows command prompt open. If this is the case with you then it is much faster to manage your windows processes from command prompt than to open up the Task Manager, just like we do on Linux using “ps” and “kill” command. Get to know the following commands and you can easily use the command prompt to see and kill processes.
1. Tasklist : This command is similar to “ps” command on Linux and is used to see the details of the programs and processes that are running in Windows. Tasklist can be applied to see how much memory and CPU time running processes are using, what DLL files they rely on, and other information. Thus it can be a very useful troubleshooting tool.
- Processes info: When you enter
tasklist
on the command prompt, you can see the following informations by default. Image Name, PID, Session Name, Session#, Mem Usage - Processes detailed info: Additional info like, Status, User Name, CPU Time, Window Title can be displayed using
tasklist /v
- Services and Processes info: Use
tasklist /svc
to get a table relating Image Name, PID, and Services, very useful to know the relationship between a process and the services that are running on a system. - dlls and Processes info: Tasks and Use
tasklist /m to
find which DLLs are used by each process. - Filtering processes: Processes can be filtered using ImageName, PID, MemUsage, Status, Username and WindowTitle. For Example,
- Use the following command to to find processes that are not responding.
tasklist /fi "status eq not responding"
- Use the folliwing to list the processes eating up more than 10MB.
tasklist /fi "memusage gt 10000"
- Use the following command to to find processes that are not responding.
- More Info: To get more info on advanced syntax of the command use
tasklist /?
or refer to Microsoft’s documentation.
(NOTE: Although Tasklist is a part of Windows XP Professional, it does not come with the Home edition. Those with the Home version of XP can download this file and can put it in the system path.)
2. Tskill : This command is used to end a process, using its name of its PID.
- Kill with name: Use
tskill processname
to kill a process with name processname. For example:tskill winword
(closes all the Microsoft documents that you have open)
- Kill with PID : Similarly use
tskill
processid
- More Info: To get more info on advanced syntax of the command use
tskill /?
or refer to Microsoft’s documentation.
(NOTE: Tskill is a part of both Windows XP Professional and the Home edition.)
3. Taskkill : Similar to Tskill, this command is also used to end a process but it provides us more options in doing so. Apart from specifying the PID or the image name of the process to kill, we can also use ceratin filters to kill the matching processes as explained below.
- Kill with name: Use
taskill /IM imagename
to kill a process with the given Image name. For example:taskkill /im notepad.exe /f
(forces notepad to be killed.)
- Kill with PID : Use
taskill /PID processid
to kill a process with the given processid. - Filtering Taskkill: Processes to be killed can be filtered using ImageName, PID, MemUsage, CPUTime, Session, Status, Username, WindowTitle, Services or Modules (dll). For Example,
- Use the following command to forcefully shut down all the processes that are not responding.
taskkill /f /fi "status eq not responding"
- Use the folliwing to close down all programs using more than 10 MB..
taskkill /f /fi "memusage gt 10000"
- Use the following command to forcefully shut down all the processes that are not responding.
- More Info: To get more info on advanced syntax of the command use
taskkill
/?
or refer to Microsoft’s documentation.
(NOTE: Taskkill is only a part of Windows XP Professional.)
Assign Folder as a Drive
commands Windows Tips- Open up "command prompt" by typing "cmd" at run box
- At "command prompt", type; "subst [drive letter] [folder path address]". eg: "subst m: d:\userfolder"
- Hit enter and you can see [as an example a new drive: m:\ drive appear in "my computer"
- Simple and easy huh? This assigned drive will be deactivate when you reboot your comp.
- So, you can make an auto startup program for this assigned drive.
- Here come the trick; Simply open up notepad and type this codes : "subst [drive letter] [folder path address]". eg: "subst m: d:\userfolder" and save it as "urfilename".bat.
- This is a batch file that runs the command when you double-click it. "urfilename" refer to any name that you want to put. But make sure you keep the file with *.bat extension in order to make it able to be executed.
- Then, simply copy this file to the startup folder under "start>all programs>startup"
- This means you have just set up that batch file to runs every time the comp rebooted
Fixing Double-Click Problems In Your Drive
commands Useful commands Windows TipsSeveral things you must know first :
1. When you double-click your drive, it can't be accessed and an alert pop-out : "cannot find file.js@file.exe@file.vbs@something similar".
2. What is the main problems?
Autorun.inf file cannot find the specific file to be executed [been deleted due to virus alert from antivirus software or accidentally deleted]
3. Autorun.inf usage :
- Not all "autorun.inf" is written to execute the VIRUS.
- "autorun.inf" may also automatically load a programs in the Interactive-CD media.
- It can load a portable software for USB drive such as "PortableApps"
- You can set your drive icon by write some codes in it [will be posted later]
- So, "autorun.inf" is NOT A VIRUS. It's a kinda file that run under System Explorer.
1st :
If you accidentally deleted the files [the programs compiled with "autorun.inf" accidentally deleted]
Solution :
Just unhide the "hidden folder" [tool > folder options > views > "tick" the "show hidden files & folder"]. Then you can delete the "autorun.inf" files [navigate into the drive using the "address bar"]. Your drive can be accessed by using double-click after the comp rebooted.
2nd :
If the files compiled with "autorun.inf" have been deleted automatically due to antivirus response to a suspected files, which means, the compiled files with "autorun.inf" is a virus suspected file. So, the virus can't be executed when you double-click the drive. Antivirus won't delete the "autorun.inf" because it is NOT A VIRUS.
Solution :
Open up Command Prompt [start > run > type "CMD"]
- The command prompt will now open. Type "attrib -s -h -r -a x:\autorun.inf"
- Then type "del x:\autorun.inf"
Explanation :
"attrib" : attribute
"s" : system file attribute
"h" : hidden file attribute
"r" : read-only file attribute
"a" : archive file attribute
"x" : this should be change with your drive letter such as C or D or any drive you want to fix
"del" : delete file
"-" : this -ve sign stand for remove, so that it will remove the attribute within the files
So. After you runs the command above, you have successfully remove the "autorun.inf" file in your drive. Just make sure you change the "x" value with your drive letter. Reboot the computer and it's done. Below is a sample advance batch file to remove "autorun.inf" that i've made specially for all my blog reader using these commands above.
Downlaod a sample batch file click here
Restart or Shutdown Windows (XP, 2000 and Vista) from Command Line or One-Click Shortcut
commandsType shutdown -s -t 01 Here "01" Means time for shutdown in no. of Seconds.
If you want brief discription for shutdown command
Type shutdown /? in command line
Multi Ping batch file script
commandsThis script will help you a lot
copy this all script in a notepad
save as
And create a computers.txt text document in c:\ ( C drive)
Here give required IP address in computers.txt file
Like
Now You can ping and check the status N number of ip's at a time.
open ping.bat file which is saved on desktop
Its going to ping all ips and open a new log file with the status of all ip's
Its really helpful to system and network administrators.
@echo off (Set InputFile=c:\Computers.txt) title,Pinging list of computers &color 9e ::datestamp for /f "tokens=2-4 skip=1 delims=(-./)" %%i in ('echo.^|date') do ( for /f "tokens=1-4 delims=-./ " %%m in ('date /t') do ( (set dow=%%m)&(set %%i=%%n)&(set %%j=%%o)&(set yy=%%p) ) ) For /F "tokens=1,2 delims=:, " %%i in ('TIME /T') Do (Set HHMM=%%i%%j) (Set OutputFile=c:\Pinglog %yy%-%mm%-%dd% %HHMM%.txt) If Exist "%OutputFile%" Del "%OutputFile%" For /F "eol=;" %%* in ('type "%InputFile%"') do ( >>"%OutputFile%" (echo.&echo.---------------&( echo.%%*;&(ping -a -n 2 -w 750 %%* | Find ".")) )&echo.done %%*,) ::check start notepad.exe %OutputFile%
Using NSlookup.exe Command Help From Microsoft
commands- The TCP/IP protocol must be installed on the computer running Nslookup.exe
- At least one DNS server must be specified when you run the IPCONFIG /ALL command from a command prompt.
- Nslookup will always devolve the name from the current context. If you fail to fully qualify a name query (that is, use trailing dot), the query will be appended to the current context. For example, the current DNS settings are att.com and a query is performed on www.microsoft.com; the first query will go out as www.microsoft.com.att.com because of the query being unqualified. This behavior may be inconsistent with other vendor's versions of Nslookup, and this article is presented to clarify the behavior of Microsoft Windows NT Nslookup.exe
- If you have implemented the use of the search list in the Domain Suffix Search Order defined on the DNS tab of the Microsoft TCP/IP Properties page, devolution will not occur. The query will be appended to the domain suffixes specified in the list. To avoid using the search list, always use a Fully Qualified Domain Name (that is, add the trailing dot to the name).
Nslookup.exe can be run in two modes: interactive and noninteractive. Noninteractive mode is useful when only a single piece of data needs to be returned. The syntax for noninteractive mode is:
nslookup [-option] [hostname] [server]
To start Nslookup.exe in interactive mode, simply type "nslookup" at the command prompt:
C:\> nslookup
Default Server: nameserver1.domain.com
Address: 10.0.0.1
>
Typing "help" or "?" at the command prompt will generate a list of available commands. Anything typed at the command prompt that is not recognized as a valid command is assumed to be a host name and an attempt is made to resolve it using the default server. To interrupt interactive commands, press CTRL+C. To exit interactive mode and return to the command prompt, type exit at the command prompt.
The following is the help output and contains the complete list of options:
Commands: (identifiers are shown in uppercase, [] means optional)
NAME - print info about the host/domain NAME using default
server
NAME1 NAME2 - as above, but use NAME2 as server
help or ? - print info on common commands
set OPTION - set an option
all - print options, current server and host
[no]debug - print debugging information
[no]d2 - print exhaustive debugging information
[no]defname - append domain name to each query
[no]recurse - ask for recursive answer to query
[no]search - use domain search list
[no]vc - always use a virtual circuit
domain=NAME - set default domain name to NAME
srchlist=N1[/N2/.../N6] - set domain to N1 and search list to N1, N2,
and so on
root=NAME - set root server to NAME
retry=X - set number of retries to X
timeout=X - set initial time-out interval to X seconds
type=X - set query type (for example, A, ANY, CNAME, MX,
NS, PTR, SOA, SRV)
querytype=X - same as type
class=X - set query class (for example, IN (Internet), ANY)
[no]msxfr - use MS fast zone transfer
ixfrver=X - current version to use in IXFR transfer request
server NAME - set default server to NAME, using current default server
lserver NAME - set default server to NAME, using initial server
finger [USER] - finger the optional NAME at the current default host
root - set current default server to the root
ls [opt] DOMAIN [> FILE] - list addresses in DOMAIN (optional: output to
FILE)
-a - list canonical names and aliases
-d - list all records
-t TYPE - list records of the given type (for example, A, CNAME,
MX, NS, PTR, and so on)
view FILE - sort an 'ls' output file and view it with pg
exit - exit the program
A number of different options can be set in Nslookup.exe by running the set command at the command prompt. A complete listing of these options is obtained by typing set all. See above, under the set command for a printout of the available options.
Looking up Different Data Types
To look up different data types within the domain name space, use the set type or set q[uerytype] command at the command prompt. For example, to query for the mail exchanger data, type the following:C:\> nslookup
Default Server: ns1.domain.com
Address: 10.0.0.1
> set q=mx
> mailhost
Server: ns1.domain.com
Address: 10.0.0.1
mailhost.domain.com MX preference = 0, mail exchanger =
mailhost.domain.com
mailhost.domain.com internet address = 10.0.0.5
>
The first time a query is made for a remote name, the answer is authoritative, but subsequent queries are nonauthoritative. The first time a remote host is queried, the local DNS server contacts the DNS server that is authoritative for that domain. The local DNS server will then cache that information, so that subsequent queries are answered nonauthoritatively out of the local server's cache.
Querying Directly from Another Name Server
To query another name server directly, use the server or lserver commands to switch to that name server. The lserver command uses the local server to get the address of the server to switch to, while the server command uses the current default server to get the address.Example:
C:\> nslookup
Default Server: nameserver1.domain.com
Address: 10.0.0.1
> server 10.0.0.2
Default Server: nameserver2.domain.com
Address: 10.0.0.2
>
Using Nslookup.exe to Transfer Entire Zone
Nslookup can be used to transfer an entire zone by using the ls command. This is useful to see all the hosts within a remote domain. The syntax for the ls command is:ls [- a | d | t type] domain [> filename]
Using ls with no arguments will return a list of all address and name server data. The -a switch will return alias and canonical names, -d will return all data, and -t will filter by type.
Example:
>ls domain.com
[nameserver1.domain.com]
nameserver1.domain.com. NS server = ns1.domain.com
nameserver2.domain.com NS server = ns2.domain.com
nameserver1 A 10.0.0.1
nameserver2 A 10.0.0.2
>
Zone transfers can be blocked at the DNS server so that only authorized addresses or networks can perform this function. The following error will be returned if zone security has been set:
For additional information, see the following article or articles in the Microsoft Knowledge Base:
Troubleshooting Nslookup.exe
Default Server Timed Out
When starting the Nslookup.exe utility, the following errors may occur:NOTE: w.x.y.z is the first DNS server listed in the DNS Service Search Order list.
The first error indicates that the DNS server cannot be reached or the service is not running on that computer. To correct this problem, either start the DNS service on that server or check for possible connectivity problems.
The second error indicates that no servers have been defined in the DNS Service Search Order list. To correct this problem, add the IP address of a valid DNS server to this list.
For additional information, see the following article or articles in the Microsoft Knowledge Base:
Can't Find Server Name when Starting Nslookup.exe
When starting the Nslookup.exe utility, the following error may occur:This error occurs when there is no PTR record for the name server's IP address. When Nslookup.exe starts, it does a reverse lookup to get the name of the default server. If no PTR data exists, this error message is returned. To correct make sure that a reverse lookup zone exists and contains PTR records for the name servers.
For additional information, see the following article or articles in the Microsoft Knowledge Base:
Nslookup on Child Domain Fails
When querying or doing a zone transfer on a child domain, Nslookup may return the following errors:In DNS Manager, a new domain can be added under the primary zone, thus creating a child domain. Creating a child domain this way does not create a separate db file for the domain, thus querying that domain or running a zone transfer on it will produce the above errors. Running a zone transfer on the parent domain will list data for both the parent and child domains. To work around this problem, create a new primary zone on the DNS server for the child domain.
APPLIES TO
- Microsoft Windows 2000 Server
- Microsoft Windows 2000 Advanced Server
- Microsoft Windows NT Server 4.0 Standard Editio
NSLOOKUP Commnad Brief Info
commandsSyntax:
nslookup
nslookup host-to-find
nslookup server
interactive mode:
nslookup -server
nslookup [-options] [host-to-find ]
Options:
host [server ]
Look up information for host using the current default server or using server,
if specified. If host is an Internet address and the query type is A or PTR ,
the name of the host is returned. If host is a name and does not have a trailing
period, the default domain name is appended to the name. (This behavior depends
on the state of the set options domain , srchlist , defname , and search.
To look up a host not in the current domain, append a period to the name.
server domain
lserver domain
Change the default server to domain ; lserver uses the initial server to look up
information about domain while server uses the current default server.
If an authoritative answer can't be found, the names of servers that might have
the answer are returned.
root
Change the default server to the server for the root of the domain name space.
Currently, the host ns.internic.net is used. (This command is a synonym for
`lserver ns.internic.net' The name of the root server can be changed with
the `set root ' command.
finger [name ] [> filename ]
finger [name ] [>> filename ]
Connects with the finger server on the current host. The current host is
defined when a previous lookup for a host was successful and returned address
information (see the `set querytype=A ' command). The name is optional. > and
>> can be used to redirect output in the usual manner.
ls [option ] domain [> filename ]
ls [option ] domain [>> filename ]
List the information available for domain , optionally creating or appending
to filename The default output contains host names and their Internet addresses.
Option can be one of the following:
-t querytype list all records of the specified type (see querytype below).
-a list aliases of hosts in the domain; synonym for `-t CNAME '
-d list all records for the domain; synonym for `-t ANY'
-h list CPU and operating system information for the domain; synonym for `-t HINFO'
-s list well-known services of hosts in the domain; synonym for `-t WKS'
When output is directed to a file, hash marks are printed for every 50 records
received from the server.
view filename
Sort and lists the output of previous ls command(s) with more(1).
set keyword [= value ]
This command is used to change state information that affects the lookups.
run man nslookup for a full list of valid keywords.
set all Print the current value of the frequently-used options
to set Information about the current default server and host is also printed.
help
? Print a brief summary of commands.
exit Exit the program.
Nslookup has two modes: interactive and non-interactive.
Interactive mode allows the user to query name servers for information about various hosts and domains or to print a list of hosts in a domain.
Non-interactive mode is used to print just the name and requested information for a host or domain.
The options listed under the `set ' command can be specified in the .nslookuprc file in the user's home directory (listed one per line). Options can also be specified on the command line if they precede the arguments and are prefixed with a hyphen.
Help for Batch file configuration
commandsOn this page you'll find a shorthand list of common tasks in batch files, and the command(s) that can be used to perform those tasks.
Notes: Many, if not most, of the commands listed here require Windows 2000 and later, some require Windows XP or later, some require Active Directory.
Read more detailed information by following the links provided.Depending on the Windows version, some commands (e.g. SETX and NETSVC) may require installation of a Resource Kit. Task Available command(s) or variable(s) Add/remove computer to/from domain NETDOM (1) Counters FOR /L or SET /A counter += 1 Delays PING Current date DATE /T or %Date% or DEBUG Current directory CD or %CD% Current drive %CD:~0,2% Current time TIME /T or %Time% or DEBUG Directory of current batch file %~dp0 Drive of current batch file %~d0 Environment, permanent changes SETX (2) Firewall configuration NETSH Harddisk & volume management DISKPART, FDISK, FORMAT, CONVERT, MOUNTVOL, VOL, CHKDSK, CHKNTFS, DEFRAG Hardware inventory WMIC IP address (local) PING %ComputerName%, NSLOOKUP %ComputerName% or IPCONFIG /ALL IP address (remote) PING, NSLOOKUP or WMIC IP address (WAN) to file WGET -O output_filename -q http://www.whatismyip.com/automation/n09230945.asp (3) IP address (WAN) to screen WGET -q -O- http://www.whatismyip.com/automation/n09230945.asp (3) Logoff Multiple commands available Open a file, folder or web page START Permissions CACLS, XCACLS (2), MMC & SECEDIT, SUBINACL (3) or SETACL (3) Popup dialogs NET Send %ComputerName% Print text NOTEPAD /P Print anything ASSOC, FTYPE & REGEDIT or REG Printer management RUNDLL32 PRINTUI.DLL,PrintUIEntry Process management Multiple commands available Prompt for user input SET /P & more Read text files FOR /F or occasionaly <> Reboot Multiple commands available Registry REGEDIT or REG Service management NET Stop, NET Start, SC or NETSVC (2) Shutdown Multiple commands available Unicode to ASCII conversion TYPE User/group management NET, DSADD, DSGET, DSMOD, DSMOVE, DSQUERY & DSRM (1) or CSVDE & LDIFDE (1) Write text files Redirected ECHO Notes: (1) Requires Windows XP with Windows Server 2003 Administration Tools Pack, or Windows Server 2003 or later. (2) Resource Kit tool (3) Third party tool
Using NSLOOKUP for DNS Server diagnosis
commandsThe DNS protocol has been around for decades and is a stable and reliable protocol. Even so, DNS does occasionally have problems. These problems might stem from a loss of connectivity, an invalid DNS record, or a number of other issues. When a DNS server doesn’t behave in the way that it is expected to, many people turn to the PING command for help. PING is a great tool for DNS server diagnosis, and I tend to use it quite frequently myself. However, sometimes PING just doesn’t give you enough information about the problem at hand. When you need more information about a DNS problem than what PING provides you with, you can always turn to the NSLOOKUP command. NSLOOKUP is a built in DNS diagnostic utility that’s available to both Windows and UNIX Administrators. In this article, I will show you how to use NSLOOKUP.
The Basics
NSLOOKUP has a fairly rich syntax and can be a bit confusing for those who have not worked with DNS a great deal. Therefore, I want to start out by showing you some of the basics. Although NSLOOKUP exists in both UNIX and Windows, there are some differences in the way that it behaves in the two operating systems. For the purposes of this article, I will be using the Windows version.
The first thing that you need to understand about NSLOOKUP is that when you use the NSLOOKUP command, it assumes that you are querying a local domain on your private network. You can query an external domain, but NSLOOKUP will try to search for the domain internally first. For example, the brienposey.com domain is external to my network. If I perform an NSLOOKUP against brienposey.com, NSLOOKUP returns the information that’s shown in Figure A.
Figure A: This is what happens when NSLOOKUP queries an external domain
If you look at the figure, you will see that there are non existent domain error messages for the IP addresses 147.100.100.34 and 147.100.100.5. These are the addresses of my internal DNS servers. Below this information however is the non authoritative answer. This means that my DNS server queried an external DNS server in an effort to resolve the IP address associated with the brienposey.com domain.
Now, let’s take a look at what happens when you query an internal domain. One of the local domains on my private network is production.com. If I perform an NSLOOKUP against production.com, I get the results shown in Figure B.
Figure B: This is what it looks like when I query an internal domain
If you look at the top portion of this screen, you will notice that I’m getting the exact same non-existent domain error messages as I got when I queried an external domain. At first, this may seem puzzling. The reason why I got this error message was because I performed an NSLOOKUP outside of the NSLOOKUP shell. I will talk more about the NSLOOKUP shell in the next section. For now though, you need to know that you can enter the NSLOOKUP command by itself. When you do, you will see the familiar non-existent domain error messages, but you will then be taken to the NSLOOKUP prompt (the > sign). From there you can enter various NSLOOKUP commands. When you are done, you can use the EXIT command to return to the command prompt.
The other thing that you should notice about Figure B is the bottom portion of the output. Beneath the reference to production.com is a string of IP addresses. These are the IP addresses of all of the domain controllers within the domain. I should also point out that if multiple IP addresses are assigned to a single server then all of the server’s IP addresses will be displayed by NSLOOKUP.
The NSLOOKUP Shell
Now that I have shown you how to use the NSLOOKUP command to see the IP address or addresses associated with the domain, let’s do something a little bit more useful. One of the things that you can do with NSLOOKUP is to look up a specific type of DNS record. A good example of this is an MX record.
In case you aren’t yet familiar with all of the intricacies of DNS, the MX record points to the organization’s mail server. For example, suppose that someone wanted to send an E-mail message to you, one of the first things that their mail server would have to do is to resolve your domain’s IP address. However, a normal address resolution won’t usually work for this purpose. In Figure A, you saw that when I ran a DNS query against the brienposey.com domain, the domain resolved to the address 24.235.10.4. Keep in mind though, that this is the IP address of the server that hosts my Web site, not the address of my mail server. If someone wanted to send me an E-mail message their E-mail client would have to resolve the IP address of my domain’s mail server. This is where the MX record comes into play. The MX record is a record on a domain’s DNS server that specifies the IP address of the domain’s mail server.
As you can see, the MX record is rather important. Suppose however that your domain was having trouble receiving E-mail and you suspected that a DNS server issue was to blame. You could use NSLOOKUP to confirm that the domain does indeed have an MX record and that the MX record is pointed to the correct IP address.
Earlier I briefly mentioned that you could work within the NSLOOKUP shell. To troubleshoot an MX record problem, you pretty much have to work within this shell. Therefore, you would start the process by entering the NSLOOKUP command at the command prompt.
Once the NSLOOKUP shell is open, you will need to tell NSLOOKUP which DNS server you want to query. To do so, enter the SERVER command, followed by the DNS server’s IP address. You can also enter the server’s fully qualified domain name (assuming that it can be resolved) as an alternative to the server’s IP address.
Now that you have specified a DNS server for NSLOOKUP to use, you can query domains without receiving the non-existent domain error messages that you saw earlier (as long as you remain within the NSLOOKUP shell). To do so, you would simply type the domain name that you want to query. For example, if you look at Figure C, you can see where I have specified a particular DNS server and then queried an external and an internal domain.
Figure C: The error messages go away if you specify a DNS server
Now, let’s get back to the business of looking up a domain’s MX record. To do so, you need to issue a command that tells NSLOOKUP to query based on MX records. The command that you will have to use is:
SET QUERY=MX
Issuing this command by itself won’t give you any information about the domain’s MX record though. For that you have to actually query the domain by entering the domain name. If you look at Figure D, you will see that I have specified an MX query and then entered the production.com domain name. NSLOOKUP now returns a wealth of information pertaining to my domain’s MX record.
Figure D: When an MX query is specified, you can get a wealth of information about your domain’s MX record
Conclusion
As you can see, NSLOOKUP can provide you with a wealth of DNS server diagnostic information. However, NSLOOKUP is not limited to providing the types of information that I have discussed. The NSLOOKUP shell is actually a fairly rich interface with a rather large command set. You can view a list of the available commands and their syntax by entering a question mark at the NSLOOKUP prompt (note: you can not use NSLOOKUP /? to view the command set).
The NET command
commandsThe NET command is used to manage requesters (networked computers), servers and network resources (network drives, printers, etcetera).
Most options of NET.EXE are also available in GUI style programs in Windows and OS/2, but for automating tasks nothing beats the command line interface of NET.EXE and its NT counterparts.
I "grew up" with OS/2 LAN Server's command line.
I automated many tasks using either batch files with NET.EXE or Rexx scripts with LAN Server RexxUtil.
After jumping on the NT train, it took me a while before I realized that I wasn't condemned to GUI style programs at all, as long as I had access to the Windows NT 4 and 2000 Server Resource Kit utilities.
Being an ex-OS/2 administrator, the first scripts I created for NT were (Regina) Rexx scripts, written for the Rexx version that comes with the Resource Kit.
After a while I switched to batch files combined with Resource Kit utilities.
To my surprise NT's batch language is almost as powerfull as a the Resource Kit's Rexx version.
One of the biggest problems when switching from LAN Server to NT is that many of NET.EXE's options have been moved to separate utilities in NT.
The following table and examples are meant as a cross reference: find the "original" LAN Manager/LAN Server command in the column on the left, and check the middle column to see what it translates to in NT.
Note that even when some NET commands remained the same, the options may still differ vastly.
Use NET HELP command
to get online help.
In OS/2 you will get even more help on the available options using NET HELP command /O
Windows NT 4's help files contain, amongst others, a very helpful translation table too.
Look at the "Contents", "Windows NT Commands", "What's New or Different from LAN Manager?".
Note: | | For NT I added several commands from the free PSTools toolkit. These tools can be used on local as well as remote systems. A must-have for Windows administrators. |
---|
LAN Server/LAN Manager and NT command translation | ||
---|---|---|
OS/2, LAN Server LAN Manager | Windows NT | Remarks |
AT | AT | Schedule tasks |
NET ACCESS | CACLS | Manage access. Alternative (non-native) commands for NT: XCACLS, SHOWACLS, RMTSHARE, SUBINACL, SECEDIT. |
NET ACCOUNTS | NET ACCOUNTS | |
NET ADMIN | RCMD (1) PSEXEC | IMHO NET ADMIN was NT's worst omission. On the other hand, RCMD (1) and PSEXEC may very well be the best replacements one could ever wish. |
NET ADMIN /C \\server NET ACCESS local_path ... | XCACLS (1) unc_path ... PSEXEC \\server CACLS local_path ... | For files only, CACLS can be used on UNC based names as well. |
NET ADMIN /C \\domaincontroller NET GROUP globalgroup ... | NET GROUP globalgroup ... /DOMAIN | |
NET ADMIN /C \\server NET SHARE share ... | RMTSHARE (1) \\server\share ... PSEXEC \\server NET SHARE share ... | |
NET ADMIN /C \\domaincontroller NET USER user_id ... | NET USER user_id ... /DOMAIN | |
NET ADMIN /C \\server NET FILE ... | PSFILE \\server ... | |
NET ALIAS | None (2) | |
NET APP | None (2) | |
NET APPPARM | None (2) | OS/2 Warp 4.5 (eComStation) only |
NET AUDIT | None (2) | |
NET COMM | None (2) | |
None (2) | NET COMPUTER | |
NET CONFIG | NET CONFIG | Display NetBIOS configuration information |
NET CONTINUE | NET CONTINUE | Continue paused services |
NET COPY | COPY XCOPY FCOPY (1) | |
NET DASD | None (2) | |
NET DEVICE | None (2) | |
NET ERROR | DUMPEL (1) PSLOGLIST | |
NET FILE | NET FILE | List files opened by remote computers |
NET FORWARD | None (2) | |
NET GROUP | NET GROUP NET LOCALGROUP | List or manage groups and group membership |
NET HELP | NET HELP NET HELPMSG | Use NET HELP to display syntax. Use NET HELPMSG to display information on error messages. |
NET LOG | None (2) | |
NET MOVE | None (2) | |
NET NAME | NET NAME | List or manage NetBIOS names |
NET PASSWORD | NET USER user_id new_password [ /DOMAIN ] | The command RUNDLL32.EXE NETPLWIZ.DLL,UsersRunDll will start the GUI for changing passwords (by Administrators only).[ Thanks for Steve Pasikowski for pointing out an error in the previously published command ] |
NET PAUSE | NET PAUSE | Pause services |
NET PRINT | NET PRINT | |
NET RIPLMACH | None (2) | OS/2 Warp 4.5 (eComStation) only |
NET RIPLMCLAS | None (2) | OS/2 Warp 4.5 (eComStation) only |
NET RUN | RCMD (1) PSEXEC | |
NET SEND | NET SEND | Send messages to other users or computers |
NET SESSION | NET SESSION | |
NET SHARE | NET SHARE | In Windows Server 2003 the default permissions on shares have changed from Everyone Full Control to Everyone Read! Use the /GRANT:Everyone,Full switch to set permissions to the old default. |
NET START | NET START | Start services |
NET STATISTICS | NET STATISTICS | |
NET STATUS | NET CONFIG and NET SHARE | |
NET STOP | NET STOP | Stop services |
NET TIME | NET TIME | Synchronize time with a remote computer, or display a remote computer's current time |
NET USE | NET USE | NT's /USER switch makes this command extremely powerfull |
NET USER | NET USER | List or manage users |
NET VIEW | NET VIEW | List domains and workgroups (NT's /DOMAIN switch only only), computers, or shared devices |
NET WHO | None (2) | IMHO this is NT's secondmost important omission. See NetWho and NetWho2 for an attempt to fill the gap. For small NT networks PSLOGGEDON may be a viable alternative. |
Notes: | (1) | This utility comes with the Windows NT Server Resource Kit |
(2) | There seems to be no command line equivalent available in NT. However, for most tasks GUI style utilities are available in NT. |
Linux / Unix finger command
commandsLists information about the user.
finger [-b] [-f] [-h] [-i] [-l] [-m] [-p] [-q] [-s] [-w] [username]
-b | Suppress printing the user's home directory and shell in a long format printout. |
-f | Suppress printing the header that is normally printed in a non-long format printout. |
-h | Suppress printing of the .project file in a long format printout. |
-i | Force "idle" output format, which is similar to short format except that only the login name, terminal, login time, and idle time are printed. |
-l | Force long output format. |
-m | Match arguments only on user name (not first or last name). |
-p | Suppress printing of the .plan file in a long format printout. |
-q | Force quick output format, which is similar to short format except that only the login name, terminal, and login time are printed. |
-s | Force short output format. |
-w | Suppress printing the full name in a short format printout. |
finger -b -p ch - Would display the following information about the user ch.
Login name: admin In real life: Computer Hope
On since Feb 11 23:37:16 on pts/7 from domain.computerhope.com
28 seconds Idle Time
Unread mail since Mon Feb 12 00:22:52 2001
ac
passwd
who
whois
Microsoft DOS arp command
commandsDisplays, adds and removes arp information from network devices.
Short for Address Resolution Protocol, ARP is a protocol used with the IP protocol for mapping a 32-bit Internet Protocol address to a MAC address that is recognized in the local network specified in RFC 826. Once recognized, the server or networking device returns a response containing the required address.
- Additional information about the MS-DOS ARP command can be found on our MS-DOS ARP command page.
- See our Linux / Unix arp command page for additional information about this systems command.
ARP -d inet_addr [if_addr]
ARP -a [inet_addr] [-N if_addr]
-a | Displays current ARP entries by interrogating the current protocol data. If inet_addr is specified, the IP and Physical addresses for only the specified computer are displayed. If more than one network interface uses ARP, entries for each ARP table are displayed. |
-g | Same as -a |
inet_addr | Specifies an Internet address. |
-N if addr | Displays the ARP entries for the network interface specified by if_addr. |
-d | Deletes the host specified by inet_addr. |
-s | Adds the host and associates the Internet address inet_addr with the Physical address eth_addr. The Physical address is given as 6 hexadecimal bytes seperated by hyphens. The entry is permanent. |
eth_addr | Specifies a physical address |
if_addr | If present, this specifies the Internet address of the interface whose address translation table should be modified. If not present, the first applicable interface will be used. |
arp -a
Interface 220.0.0.80
Internet Address | Physical Address | Type |
220.0.0.160 | 00-50-04-62-F7-23 | static |
The Physical Address or MAC address as shown above in the format aa-bb-cc-dd-ee-ff is the unique manufacturer identification number. This number should always be a unique address.
An example of how to change the above IP address 220.0.0.160 to 220.0.0.161 in this case would be:
arp -s 220.0.0.161 00-50-04-62-F7-23
If an IP address has already been assigned to the specific network adapter it is not possible to change that assigned IP address to a new address. In addition, networks italicizing DHCP, BOOTP or RARP will automatically assign the card an IP address, therefore, this command would not be utilized.
Root
commands1. Also known as an admin, administrator, and gatekeeper this account is a super user on a computer and/or network and has complete control over it. When referring to a Unix / Linux computer this user is often known as root and on a Windows computer and network this user is often referred to as an administrator. However, each of these terms is interchangeable.
- Information about determining if an account has administrator rights on document CH001093.
- See document CH001096 for additional information about why you may not be able to log into the administrator account.
- Additional information about giving a Windows account administrative rights on document CH001097.
- See our su or super user command page for additional information on this Linux command.
2. The highest level in a directory hierarchy. For example, in MS-DOS, the root of the primary hard disk drive would C:\.
- Additional information and help with MS-DOS can be found on our MS-DOS help page.
- Users in the Microsoft recovery console can set the current directory to the system root directory by using the systemroot command.
Help with ping, winipcfg, and other network commands.
commandsIssue:Help with ping, winipcfg, and other network commands. Cause:It may Solution:Below is a Note: If you are not the root or admin of a computer, it is possible Arp Display or
The finger
The hostname
Ipconfig is a MS-DOS utility that Windows 2000 users
Pathping is a MS-DOS utility
The nbtstat MS-DOS utility that displays protocol
The net command
The netstat command is used to display the TCP/IP network
The nslookup MS-DOS utility that enables a user to do a reverse lookup on an IP address of a domain
The route MS-DOS
The tracert command in MS-DOS / Windows or the traceroute command in Unix / Linux and variants is
The whois command available in Unix / Linux variants helps
The winipcfg command available in Windows allows a user to
NOTE: Windows |