The S R Store

Search This Blog

Showing posts with label command prompt/dos. Show all posts
Showing posts with label command prompt/dos. Show all posts

Friday, October 24, 2008

TOP 10 COMMAND LINE TOOLS

1 - systeminfo - Have a need to display operating system configuration information for a local or remote machine, including service pack levels? Then systeminfo is the tool to use. When I need to connect to a system that I am not familiar with, this is the first tool I run. The output of this command gives me all the info I need including: host name, OS type, version, product ID, install date, boot time and hardware info (processor and memory). Also knowing what hot fixes are installed can be a big help when troubleshooting problems. This tool can be used to connect to a machine remotely using the following syntax: SYSTEMINFO /S system /U user

2 - ipconfig - This tool may be most useful tool for viewing and troubleshooting TCP/IP problems. It’s capability includes release or renew an adapter IP Address, display and flush DNS cache, re-register the system name in DNS. WIth Vista and some server versions, ipconfig includes support for IPv6.
Some examples when usinging ipconfig.
To view all TCP/IP information, use: ipconfig /all
To view the local DNS cache, use: ipconfig /displaydns
To delete the contents in the local DNS cache, use: ipconfig /flushdns

3 - tasklist and taskkill - If you are used to Windows Task Manager, then you’ll find tasklist very easy to use. This tool displays a list of currently running processes, including image name, PID (Process ID) and memory usage on local or remote machines. Using the /V switch displays more information in verbose mode that includes, CPU Time, user name, and modules. Tasklist includes a filter option to display a set of task based on the criteria specified.
A single or multiple processes can be killed using the PID (/PID ) or image name (/IM ). Here are two examples for doing just that:
TASKKILL /IM notepad.exe
TASKKILL /PID 1230 /PID 1241 /PID 1253 /T
Both tasklist and taskkill can connect to remote systems using the /S (system name) /U (user name) switches.

4 - netstat - Need to know who (or what) is making a connection to your computer? Then netstat is the tool you want to run. The output provides valuable information of all connections and listening ports, including the executable used in the connections. In additon to the above info, you can view Ethernet statistics, and resolve connecting host IP Addresses to a fully qualified domain name. I usually run the netstat command using the -a (displays all connection info), -n (sorts in numerical form) and -b (displays executable name) switches.

5 - type - A lesser known tool to those who don’t work with the command prompt. For Administrators, the type command is the perfect tool for viewing text files. But what many people don’t know about the type tool, is it’s capability to read multiple files at once. For example to view multiple text files, just separate each file with a space:
type firstfile.txt secondfile.txt thirdfile.txt

6 - net command - Although this tool is more known as a command, the net command is really like a power drill with different bits and is used to update, fix, or view the network or network settings.
It is mostly used for viewing (only services that are started), stopping and starting services:
• net stop server
• net start server
• net start (display running services)
and for connecting (mapping) and disconnecting with shared network drives:
• net use m: \\myserver\sharename
• net use m: \\myserver\sharename /delete
Other commands used with net command are, accounts (manage user accounts), net print (manage print jobs), and net share (manage shares).
Below are all the options that can be used with the net command.
[ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP |HELPMSG | LOCALGROUP | PAUSE | PRINT | SESSION | SHARE | START |STATISTICS | STOP | TIME | USE | USER | VIEW ]
To display the complete syntax for each command, just type net help followed by the command - net help use .

7 - nslookup - With the Internet, DNS (Domain Name Service) is the key for allowing us to use friendly names when surfing the web instead of needing to remember IP Addresses. But when there are problems, nslookup can be a valuable tool for testing and troubleshooting DNS servers.
Nslookup can be run in two modes: interactive and noninteractive. Noninteractive mode is useful when only a single piece of data needs to be returned.

Don’t let the help results intimidate you. Nslookup is easy to use. Some of the options I use when troubleshooting are:
set ds (displays detailed debugging information of behind the scenes communication when resolving an host or IP Address).
set domain (sets the default domain to use when resolving, so you don’t need to type the fully qualified name each time).
set type (sets the query record type that will be returned, such as A, MX, NS)
server NAME (allows you to point nslookup to use other DNS servers than what is configured on your computer)
To exit out of interactive mode, type exit .

8 - ping and tracert - These tools can be helpful with connectivity to other systems. Ping will test whether a particular host is reachable across an IP network, while tracert (traceroute) is used to determine the route taken by packets across an IP network.
To ping a system just type at the prompt: ping www.google.com. By default, ping will send three ICMP request to the host and listen for ICMP “echo response” replies. Ping also includes switches to control the number of echo requests to send (-n ), and to resolve IP addresses to hostname (-a ).
To use tracert, type at the prompt: tracert www.google.com. You can force tracert to not resolve address to hostnames by using the -d switch, or set the desired timeout (milliseconds) for each reply using -w switch.

9 - gpresult - Used mostly in environments that implement group poicies, gpresults (Group Policy Results) verifies all policy settings in effect for a specific user or computer. The command is simple to use, just enter gpresults at the prompt. It can also be used to connect to computers remotely using the /S and /U switches.
10 - netsh - Without a doubt the most powerful command line tool available in Windows. Netsh is like the swiss army knife for configuring and monitoring Windows computers from the command prompt. It capabilities include:
• Configure interfaces
• Configure routing protocols
• Configure filters
• Configure routes
Configure remote access behavior for Windows-based remote access routers that are running the Routing and Remote Access Server (RRAS) Service
Display the configuration of a currently running router on any computer

OUTPUT TEXT FROM DOS TO FILE

Output Text from Dos Prompt to File

The trick saves the outputs into a file, instead of displaying the outputs on the screen.
Through this trick you can copy the 'help text that appears when you put /? in front of the command.

Now the Trick:
simply put a ">" and the destination file at the end of the dos command.
For Example:

This command outputs the IP configurations to the file "ipdata.txt" in "C" drive:
ipconfig /all > C:\ipdata.txt

DOS EVENT MONITERING (NEW DOS COMMANDS)

For those skilled in the art of DOS batch files, XP has a number of interesting new commands.
These include :

EVENTCREATE = This command line tool enables an administrator to create a custom event ID & message in a specified event log.

EVENTTRIGGERS = This tool enables an administrator to display & configure “eventtriggers” on local or remote system.

TYPEPERF = Typeperf writes performance data to the command window or to a log file.
To stop typeperf, press CTRL +C.

SCHTASKS = Enables an Administrator to create, delete, query, change, run, and end scheduled tasks on a local or remote system. Replaces At .exe.


FOR DETAILED INFORMATION ON THESE COMMANDS TYPE “ /? ’ AFTER THE COMMAND AND YOU WILL GET ALL RELATED INFO.
EXAMPLE: C:\>EVENTECREATE /? (NOTE: Don’t ignore the space before the /? )

Thursday, October 23, 2008

All DOS commands

ADDUSERS             Add or list users to/from a CSV file
ARP                          Address Resolution Protocol
ASSOC                    Change file extension associations
ASSOCIAT              One step file association
AT                            Schedule a command to run at a later time
ATTRIB                   Change file attributes
BOOTCFG              Edit Windows boot settings
BROWSTAT           Get domain, browser and PDC info
CACLS                   Change file permissions
CALL                      Call one batch program from another
CD                          Change Directory - move to a specific Folder
CHANGE               Change Terminal Server Session properties
CHKDSK               Check Disk - check and repair disk problems
CHKNTFS             Check the NTFS file system
CHOICE                Accept keyboard input to a batch file
CIPHER                 Encrypt or Decrypt files/folders
CleanMgr               Automated cleanup of Temp files, recycle bin
CLEARMEM         Clear memory leaks
CLIP                      Copy STDIN to the Windows clipboard.
CLS                       Clear the screen
CLUSTER             Windows Clustering
CMD                     Start a new CMD shell
COLOR                Change colors of the CMD window
COMP                  Compare the contents of two files or sets of files
COMPACT           Compress files or folders on an NTFS partition
COMPRESS         Compress individual files on an NTFS partition
CON2PRT            Connect or disconnect a Printer
CONVERT           Convert a FAT drive to NTFS.
COPY                  Copy one or more files to another location
CSVDE                Import or Export Active Directory data
DATE                  Display or set the date
Dcomcnfg             DCOM Configuration Utility
DEFRAG             Defragment hard drive
DEL                     Delete one or more files
DELPROF           Delete NT user profiles
DELTREE            Delete a folder and all subfolders
DevCon                Device Manager Command Line Utility
DIR                      Display a list of files and folders
DIRUSE               Display disk usage
DISKCOMP       Compare the contents of two floppy disks
DISKCOPY        Copy the contents of one floppy disk to another
DNSSTAT           DNS Statistics
DOSKEY            Edit command line, recall commands, and create macros
DSADD              Add user (computer, group..) to active directory
DSQUERY          List items in active directory
DSMOD              Modify user (computer, group..) in active directory
ECHO                 Display message on screen
ENDLOCAL       End localisation of environment changes in a batch file
ERASE                Delete one or more files
EXIT                   Quit the CMD shell
EXPAND           Uncompress files
EXTRACT         Uncompress CAB files
FC                     Compare two files
FDISK              Disk Format and partition
FIND                Search for a text string in a file
FINDSTR         Search for strings in files
FOR                 Conditionally perform a command several times
FORFILES       Batch process multiple files
FORMAT         Format a disk
FREEDISK      Check free disk space (in bytes)
FSUTIL            File and Volume utilities
FTP                  File Transfer Protocol
FTYPE             Display or modify file types used in file extension associations
GLOBAL         Display membership of global groups
GOTO              Direct a batch program to jump to a labelled line
HELP               Online Help
HFNETCHK    Network Security Hotfix Checker
IF                     Conditionally perform a command
IFMEMBER     Is the current user in an NT Workgroup
IPCONFIG       Configure IP
KILL               Remove a program from memory
LABEL            Edit a disk label
LOCAL           Display membership of local groups
LOGEVENT   Write text to the NT event viewer.
LOGOFF         Log a user off
LOGTIME       Log the date and time in a file
MAPISEND    Send email from the command line
MEM               Display memory usage
MD                  Create new folders
MODE             Configure a system device
MORE              Display output, one screen at a time
MOUNTVOL   Manage a volume mount point
MOVE              Move files from one folder to another
MOVEUSER     Move a user from one domain to another
MSG                 Send a message
MSIEXEC         Microsoft Windows Installer
MSINFO           Windows NT diagnostics
MSTSC             Terminal Server Connection (Remote Desktop Protocol)
MUNGE            Find and Replace text within file(s)
MV                   Copy in-use files
NET                  Manage network resources
NETDOM         Domain Manager
NETSH             Configure network protocols
NETSVC          Command-line Service Controller
NBTSTAT        Display networking statistics (NetBIOS over TCP/IP)
NETSTAT        Display networking statistics (TCP/IP)
NOW               Display the current Date and Time
NSLOOKUP   Name server lookup
NTBACKUP   Backup folders to tape
NTRIGHTS     Edit user account rights
PATH              Display or set a search path for executable files
PATHPING     Trace route plus network latency and packet loss
PAUSE            Suspend processing of a batch file and display a message
PERMS            Show permissions for a user
PERFMON     Performance Monitor
PING              Test a network connection
POPD             Restore the previous value of the current directory saved by PUSHD
PORTQRY     Display the status of ports and services
PRINT            Print a text file
PRNCNFG     Display, configure or rename a printer
PRNMNGR    Add, delete, list printers set the default printer
PROMPT        Change the command prompt
PsExec             Execute process remotely
PsFile               Show files opened remotely
PsGetSid           Display the SID of a computer or a user
PsInfo              List information about a system
PsKill              Kill processes by name or process ID
PsList              List detailed information about processes
PsLoggedOn   Who’s logged on (locally or via resource sharing)
PsLogList        Event log records
PsPasswd       Change account password
PsService        View and control services
PsShutdown    Shutdown or reboot a computer
PsSuspend       Suspend processes
PUSHD          Save and then change the current directory
QGREP          Search file(s) for lines that match a given pattern.
RASDIAL      Manage RAS connections
RASPHONE  Manage RAS connections
RECOVER     Recover a damaged file from a defective disk.
REG                Read, Set or Delete registry keys and values
REGEDIT        Import or export registry settings
REGSVR32     Register or unregister a DLL
REGINI           Change Registry Permissions
REM                Record comments (remarks) in a batch file
REN                Rename a file or files.
REPLACE       Replace or update one file with another
RD                   Delete folder(s)
RDISK             Create a Recovery Disk
RMTSHARE    Share a folder or a printer
ROBOCOPY  Robust File and Folder Copy
ROUTE           Manipulate network routing tables
RUNAS           Execute a program under a different user account
RUNDLL32     Run a DLL command (add/remove print connections)
SC                   Service Control
SCHTASKS     Create or Edit Scheduled Tasks
SCLIST           Display NT Services
ScriptIt             Control GUI applications
SET                 Display, set, or remove environment variables
SETLOCAL    Begin localisation of environment changes in a batch file
SETX              Set environment variables permanently
SHARE           List or edit a file share or print share
SHIFT            Shift the position of replaceable parameters in a batch file
SHORTCUT   Create a windows shortcut (.LNK file)
SHOWGRPS   List the NT Workgroups a user has joined
SHOWMBRS  List the Users who are members of a Workgroup
SHUTDOWN  Shutdown the computer
SLEEP             Wait for x seconds
SOON              Schedule a command to run in the near future
SORT                Sort input
START             Start a separate window to run a specified program or command
SU                    Switch User
SUBINACL      Edit file and folder Permissions, Ownership and Domain
SUBST             Associate a path with a drive letter
SYSTEMINFO  List system configuration
TASKLIST         List running applications and services
TIME                  Display or set the system time
TIMEOUT          Delay processing of a batch file
TITLE               Set the window title for a CMD.EXE session
TOUCH           Change file timestamps
TRACERT        Trace route to a remote host
TREE               Graphical display of folder structure
TYPE                Display the contents of a text file
USRSTAT         List domain usernames and last login
VER                  Display version information
VERIFY           Verify that files have been saved
VOL                 Display a disk label
WHERE            Locate and display files in a directory tree
WHOAMI        Output the current UserName and domain
WINDIFF        Compare the contents of two files or sets of files
WINMSD        Windows system diagnostics
WINMSDP      Windows system diagnostics II
WMIC              WMI Commands
XCACLS          Change file permissions
XCOPY            Copy files and folders

CHANGING FAT-NTFS FROM COMMAND PROMPT

To change ur File system from command prompt

type: convert c:/fs:ntfs(ex:’c’ is the drive letter to be converted.) in your command prompt.

Just wait for a few minutes and wow! Your file system is changed to NTFS.

MAKE YOUR OWN COMMAND PROMPT

{Note: use this trick only if u have lost ur command prompt due to a virus or accidently.)

NOTEPAD TRICK:

Open notepad. Type “command.com”(without quotes) & save it as anything.bat.

Now close it and open it again for a command prompt.

INTERNET EXPLORER TRICK:.( In case when you can not find notepad .)

Open internet explorer. Right click & click on “view source”. Notepad opens. Now do as above