Showing posts with label Command Prompt. Show all posts
Showing posts with label Command Prompt. Show all posts

Tuesday, November 22, 2011

More (Recovery Console)

What is the More Command?:

The more command is a Recovery Console command used to display the contents of a text file on your computer screen.
The more command can be used interchangeably with the type command.
A more command is also available from the Command Prompt.

More Command Syntax:

more [drive:][path] filename
drive = This is the drive letter that contains the filename.
path = This is the folder or folder path that contains the filename.
filename = This is the name of the text file that you want to display the contents of on screen.

More Command Examples:

more kb885835.log
In the above example, typing the more command followed by the kb885835.log file name will show the contents of the file on screen.
Since I didn't give any drive: or path information, the more command will display the contents of the kb885835.log file that's contained in the folder that I happen to be in.
more c:\windows\system32\spupdwxp.old
In this example, the more command is used to show the contents of the spupdwxp.old file located in the c:\windows\system32 folder.

How To Read Command Syntax

The syntax of a command is basically the rules for running the command. You need to know how to read syntax notation when learning how to use a command so you can use it properly.
As you've probably seen on my site and maybe others, Command Prompt commands, DOS commands, and even many run commands are described with all sorts of slashes, brackets, italics, etc. Once you know what all of those marks refer to, you can look at any command's syntax and know right away what options are required and what options can be used with what other options.
Note: Depending on the source, you might see slightly different syntax when used to describe commands. I used a method that Microsoft has historically used but all command syntax that I've every seen on any site is extremely similar to what I use.
The Command Syntax Key at the bottom of the page describes how each notation in a command's syntax is to be used so feel free to reference it as we walk through three examples:
Example #1: Vol Command
vol [drive:]
This is the syntax for the vol command, a command available from the Command Prompt in all versions of the Windows operating system.
The word vol is in bold, meaning that it should be taken literally. It's also outside of any brackets, meaning it's required. We'll take a look at brackets a few paragraphs down.
Following vol is a space. Spaces in a command's syntax are to be taken literally so when you're executing the vol command, you will need to put a space between vol and anything that might come next.
Brackets indicate that whatever is contained inside them is optional - whatever is in there is not required for the command to function but might be something you want to use, depending on what you're using the command for. Brackets are never to be taken literally so never include them when executing a command.
Inside the brackets is the italicized word drive, followed by a colon in bold. Anything italicized is something you must supply, not take literally. In this case, drive is referring to a drive letter so you'll want to supply a drive letter here. Just as with vol, since : is in bold, it should be typed as shown.
Based on all of that information, here are some valid and invalid ways to execute the vol command and why:
vol
Valid: The vol command can be executed by itself because drive: is optional because it's surrounded with brackets.
vol d
Invalid: This time, the optional part of the command is being used, specifying drive as d, but the colon was forgotten. Remember, we know the colon accompanies the drive because it is included in the same set of brackets and we know it should be used literally because it's bold.
vol e: /p
Invalid: The /p option wasn't listed in the command syntax so the vol command does not run when using it.
vol c:
Valid: In this case, the optional drive: argument was used just as intended.
Example #2: Shutdown Command
shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f] [/m \\computername] [/t xxx] [/d [p:|u:]xx:yy] [/c "comment"]
The syntax listed above for the shutdown command is obviously much more complex than in the first example but building on what you already know, there's actually very little more to learn here.
Remember that items within brackets are always optional, items outside of brackets are always required, bold items and spaces are always literal, and italicized items are to be provided by you.
The big new concept in this example is the vertical bar. Vertical bars within brackets indicate optional choices. So in the example above, you can, but don't have to, choose to include one of the following options when executing a shutdown command: /i, /l, /s, /r, /g, /a, /p, /h, or /e. Like brackets, vertical bars exist to explain command syntax and are not to be taken literally.
The shutdown command also has a nested option in [/d [p:|u:]xx:yy] - basically, an option within an option.
Like with the vol command in Example #1 above, here are some valid and invalid ways to use the shutdown command:
shutdown /r /s
Invalid: The /r and /s options can not be used together. These vertical bars indicate choices, of which you can choose only one.
shutdown /s p:0:0
Invalid: Using /s is perfectly fine but the use of p:0:0 is not because this option is available only within the /d option, which I forgot to use. The correct usage would have been shutdown /s /d p:0:0.
shutdown /r /f /t 0
Valid: All options were used correctly this time. The /r option was not used with any other choice within its set of brackets, and the /f and /t options were used as described in the syntax.
Example #3: Net Use Command
net use [{devicename | *}] [\\computername\sharename [{password | *}]] [/persistent:{yes | no}] [/savecred] [/delete]
For our final example, let's look at the net use command, one of the net commands. The net use command syntax is a little messy so I've abbreviated it to make explaining it a bit easier. You can see the full syntax here.
The net use command has two instances of a new notation, the brace. A brace indicates that one, and only one, of the choices, separated by one or more vertical bars, is required. This is unlike the bracket with vertical bars that indicates optional choices.
Let's look at some valid and invalid uses of net use:
net use e: * \\server\files

Invalid: The first set of braces mean that you can specify a devicename or use the wildcard character * - you can't do both. Either net use e: \\server\files or net use * \\server\files would have been valid ways to execute net use in this case.
net use * \\appsvr01\source 1lovet0visitcanada /persistent:no

Valid: I correctly used several options in this execution of net use, including one nested option. I used the * when required to choose between it and specifying a devicename, I specified a share [source] on a server [appsvr01], and then chose to specify a {password} for that share, 1lovet0visitcanada, instead of forcing net use to prompt me for one {*}. I also decided not to allow this new shared drive to be automatically reconnected next time I start my computer [/persistent:no].
net use /persistent
Invalid: In this example, I chose to use the optional /persistent switch but I forgot to include the colon next to it and also forgot to choose between the two required options, yes or no, between the braces. Executing net use /persistent:yes would have been a valid use of net use.

Command Syntax Key

Notation Meaning
Bold Bold items must typed exactly as they are shown, this includes any bold words, slashes, colons, etc.
Italic Italic items are items that you must supply. Do not take an italic item literally and use it in the command as shown.
S p a c e s All spaces should be taken literally. If a command's syntax has a space, use that space when executing the command.
[Text inside brackets] Any items inside a bracket are optional. Brackets are not to be taken literally so don't use them when executing a command.
Text outside brackets Any text not contained in a bracket is required. In the syntax of many commands, the only text not surrounded by one or more brackets is the command name itself.
{Text inside braces} The items within a brace are options, of which you must choose only one. Braces are not to be taken literally so don't use them when executing a command.
Vertical | bar Vertical bars are used to separate items within brackets and braces. Do not take vertical bars literally - do not use them when executing commands.
Ellipsis ... An ellipsis means that an item can be repeated indefinitely. Do not type ellipsis literally when executing a command and take care to use spaces and other required items as shown when repeating items.


Note: Brackets are also sometimes referred to as square brackets, braces are sometimes referred to as squiggly brackets or flower brackets, and vertical bars are sometimes called pipes, vertical lines, or vertical slashes. Regardless what you call them, none should ever be taken literally when executing a command.

What is the Net Use Command?

The net use command is a Command Prompt command that's used to connect to, remove, and configure connections to shared resources, like mapped drives and network printers.
The net use command is one of many net commands.

Net Use Command Syntax:

net use [{devicename | *}] [\\computername\sharename[\volume] [{password | *}]] [/user:[domainname\]username] [/user:[dotteddomainname\]username] [/user:[username@dotteddomainname] [/home {devicename | *} [{password | *}]] [/persistent:{yes | no}] [/smartcard] [/savecred] [/delete] [/help] [/?]

Tip: See How To Read Command Syntax if you're not sure how to interpret the net use command syntax shown above.
Execute the net use command alone to show detailed information about currently mapped drives and devices.
devicename = Use this option to specify the drive letter or printer port you want to map the network resource to. For a shared folder on the network, specify a drive letter from D: through Z: and for a shared printer, LPT1: through LPT3:. Use * instead of specifying devicename to automatically assign the next available drive letter, starting with Z: and moving backwards, for a mapped drive.
\\computername\sharename = This specifies the name of the computer, computername, and the shared resource, sharename, like a shared folder on a or shared printer connected to computername. If there are spaces anywhere here, be sure to put the entire path, slashes included, in quotes.
volume = Use this option to specify the volume when connecting to a NetWare server.
password = This is the password needed to access the shared resource on computername. You can choose enter the password during the execution of the net use command by typing * instead of the actual password.
/user = Use this net command option to specify a username to connect to the resource with. If you don't use /user, net use will attempt to connect to the network share or printer with your current username.
domainname = Specify a different domain than the one you're on, assuming you're on one, with this option. Skip domainname if you're not on a domain or you want net use to use the one you're on already.
username = Use this option with /user to specify the username to use to connect to the shared resource.
dotteddomainname = This option specifies the fully qualified domain name where username exists.
/home = This net use command option maps the current user's home directory to either the devicename drive letter or the next available drive letter with *.
/persistent:{yes | no} = Use this option to control the persistence of connections created with the net use command. Choose yes to automatically restore created connections at the next logon or choose no to limit the life of this connection to this session. You can shorten this switch to /p if you like.
/smartcard = This switch tells the net use command to use the credentials present on the available smart card.
/savecred = This option stores the password and user information for use next time you connect in this session or in all future sessions when used with /persistent:yes.
/delete = This net use command is used to cancel a network connection. Use /delete with devicename to remove a specified connection or with * to remove all mapped drives and devices. This option can be shortened to /d.
/help = Use this option, or the shortened /h, to display detailed help information for the net use command. Using this switch is the same as using the net help command with net use: net help use.
/? = The standard help switch also works with the net use command but the only displays the command syntax, not any detailed information about the command's options.
Tip: You can save the output of the net use command to a file using a redirection operator. See How To Redirect Command Output to a File for help doing that, or see Command Prompt Tricks for this and more tips.

Net Use Command Examples:

net use * "\\server\my media" /persistent:no
In this example, I used the net use command to connect to the my media shared folder on a computer named server. The my media folder will be mapped to my highest free drive letter [*], which for me happens to be y:, but I don't want to continue mapping this drive every time I log on to my computer [/persistent:no].
net use e: \\usrsvr002\smithmark Ue345Ii /user:pdc01\msmith2 /savecred /p:yes
Here's a slightly more complicated example that you might see in a business setting.
In this net use example, I want to map my e: drive to the smithmark shared folder on usrsvr002. I want to connect as another user account I have [/user] by the name of msmith2 that's stored on the pdc01 domain with a password of Ue345Ii. I don't want to map this drive manually every time I start my computer [/p:yes] nor do I want to enter my username and password each time [/savecred].
net use p: /delete
I suppose an appropriate final example of net use would be the removal [/delete] of a currently mapped drive, in this case p:.

Net Use Command Availability:

The net use command is available from within the Command Prompt in Windows 7, Windows Vista and Windows XP, as well as in older versions of Windows and in Windows Server operating systems.
Note: The availability of certain net use command switches and other net use command syntax may differ from operating system to operating system.

How To Redirect Command Output to a File

Many Command Prompt commands, and DOS commands for that matter, are executed not just to do something, but to provide you with information. The ping command, dir command, tracert command, and several others come to mind when I think of popular commands that produce a lot of data in the Command Prompt window.
Unfortunately, three hundred lines of information from the dir command doesn't do you much good as it rushes by. What if you want to actually look at it, or send it to a tech support group, or use it in a spreadsheet, etc.?
This is where a redirection operator becomes very useful. Using a redirection operator, you can redirect the output of a command to a file. In other words, all the information that's displayed in the Command Prompt after running a command can instead be saved to a file which you can open in Windows to reference later or manipulate however you like.
While there are several redirection operators, which you can read in detail about here, two in particular are used to output the results of a command to a file: the greater-than sign, >, and the double greater-than sign, >>.
The easiest way to learn how to use these redirection operators is to see some examples:
ipconfig /all > mynetworksettings.txt
In this example, I save all the network configuration information that I'd usually see on screen after running ipconfig /all to a file by the name of mynetworksettings.txt.
As you can see, the > redirection operator goes between the ipconfig command and the name of the file I want to store the information in. If the file already exists, it'll be overwritten. If it doesn't already exist, it will be created.
ping 10.1.0.12 > "C:\Users\Tim\Desktop\Ping Results.txt"
Here, I execute the ping command and output the results to a file by the name of Ping Results.txt located on my desktop, which is at C:\Users\Tim\Desktop. I wrapped the entire file path in quotes because there was a space involved.
Remember, when using the > redirection operator, the file I specify is created if it doesn't already exist and is overwritten if it does exist.
ipconfig /all >> \\server\files\officenetsettings.log
This example uses the >> redirection operator which functions in much the same way as the > operator, only instead of overwriting the output file if it exists, it appends the command output to the end of the file.
So let's say the first time you use this command is on Computer A. The officenetsettings.log file is created and the result of ipconfig /all on Computer A is written to the file. Next you run the same command on Computer B. This time, however, the result is added to the officenetsettings.log so the network information from both Computer A and Computer B are included in the file.

As you might have already realized, the >> redirection operator is really useful when you're collecting similar information from multiple computers or commands and you'd like all of that data in a single file.

Thursday, September 22, 2011

StarWars Movie in Command Prompt

Just type in
telnet towel.blinkenlights.nl
in the 'Run' command and
watch the episode!

Monday, March 22, 2010

All windows shortcuts - exclusive



Command Prompt:
ANSI.SYS Defines functions that change display graphics, control cursor movement, and reassign keys.
APPEND Causes MS-DOS to look in other directories when editing a file or running a command.
ARP Displays, adds, and removes arp information from network devices.
ASSIGN Assign a drive letter to an alternate letter.
ASSOC View the file associations.
AT Schedule a time to execute commands or programs.
ATMADM Lists connections and addresses seen by Windows ATM call manager.
ATTRIB Display and change file attributes.
BATCH Recovery console command that executes a series of commands in a file.
BOOTCFG Recovery console command that allows a user to view, modify, and rebuild the boot.ini
BREAK Enable / disable CTRL + C feature.
CACLS View and modify file ACL's.
CALL Calls a batch file from another batch file.
CD Changes directories.
CHCP Supplement the International keyboard and character set information.
CHDIR Changes directories.
CHKDSK Check the hard disk drive running FAT for errors.
CHKNTFS Check the hard disk drive running NTFS for errors.
CHOICE Specify a listing of multiple options within a batch file.
CLS Clears the screen.
CMD Opens the command interpreter.
COLOR Easily change the foreground and background color of the MS-DOS window.
COMP Compares files.
COMPACT Compresses and uncompress files.
CONTROL Open control panel icons from the MS-DOS prompt.
CONVERT Convert FAT to NTFS.
COPY Copy one or more files to an alternate location.
CTTY Change the computers input/output devices.
DATE View or change the systems date.
DEBUG Debug utility to create assembly programs to modify hardware settings.
DEFRAG Re-arrange the hard disk drive to help with loading programs.
DEL Deletes one or more files.
DELETE Recovery console command that deletes a file.
DELTREE Deletes one or more files and/or directories.
DIR List the contents of one or more directory.
DISABLE Recovery console command that disables Windows system services or drivers.
DISKCOMP Compare a disk with another disk.
DISKCOPY Copy the contents of one disk and place them on another disk.
DOSKEY Command to view and execute commands that have been run in the past.
DOSSHELL A GUI to help with early MS-DOS users.
DRIVPARM Enables overwrite of original device drivers.
ECHO Displays messages and enables and disables echo.
EDIT View and edit files.
EDLIN View and edit files.
EMM386 Load extended Memory Manager.
ENABLE Recovery console command to enable a disable service or driver.
ENDLOCAL Stops the localization of the environment changes enabled by the setlocal command.
ERASE Erase files from computer.
EXIT Exit from the command interpreter.
EXPAND Expand a M*cros*ft Windows file back to it's original format.
EXTRACT Extract files from the M*cros*ft Windows cabinets.
FASTHELP Displays a listing of MS-DOS commands and information about them.
FC Compare files.
FDISK Utility used to create partitions on the hard disk drive.
FIND Search for text within a file.
FINDSTR Searches for a string of text within a file.
FIXBOOT Writes a new boot sector.
FIXMBR Writes a new boot record to a disk drive.
FOR Boolean used in batch files.
FORMAT Command to erase and prepare a disk drive.
FTP Command to connect and operate on a FTP server.
FTYPE Displays or modifies file types used in file extension associations.
GOTO Moves a batch file to a specific label or location.
GRAFTABL Show extended characters in graphics mode.
HELP Display a listing of commands and brief explanation.
IF Allows for batch files to perform conditional processing.
IFSHLP.SYS 32-bit file manager.
IPCONFIG Network command to view network adapter settings and assigned values.
KEYB Change layout of keyboard.
LABEL Change the label of a disk drive.
LH Load a device driver in to high memory.
LISTSVC Recovery console command that displays the services and drivers.
LOADFIX Load a program above the first 64k.
LOADHIGH Load a device driver in to high memory.
LOCK Lock the hard disk drive.
LOGON Recovery console command to list installations and enable administrator login.
MAP Displays the device name of a drive.
MD Command to create a new directory.
MEM Display memory on system.
MKDIR Command to create a new directory.
MODE Modify the port or display settings.
MORE Display one page at a time.
MOVE Move one or more files from one directory to another directory.
MSAV Early M*cros*ft Virus scanner.
MSD Diagnostics utility.
MSCDEX Utility used to load and provide access to the CD-ROM.
NBTSTAT Displays protocol statistics and current TCP/IP connections using NBT
NET Update, fix, or view the network or network settings
NETSH Configure dynamic and static network information from MS-DOS.
NETSTAT Display the TCP/IP network protocol statistics and information.
NLSFUNC Load country specific information.
NSLOOKUP Look up an IP address of a domain or host on a network.
PATH View and modify the computers path location.
PATHPING View and locate locations of network latency.
PAUSE Command used in batch files to stop the processing of a command.
PING Test / send information to another network computer or network device.
POPD Changes to the directory or network path stored by the pushd command.
POWER Conserve power with computer portables.
PRINT Prints data to a printer port.
PROMPT View and change the MS-DOS prompt.
PUSHD Stores a directory or network path in memory so it can be returned to at any time.
QBASIC Open the QBasic.
RD Removes an empty directory.
REN Renames a file or directory.
RENAME Renames a file or directory.
RMDIR Removes an empty directory.
ROUTE View and configure windows network route tables.
RUNAS Enables a user to execute a program on another computer.
SCANDISK Run the scandisk utility.
SCANREG Scan registry and recover registry from errors.
SET Change one variable or string to another.
SETLOCAL Enables local environments to be changed without affecting anything else.
SETVER Change MS-DOS version to trick older MS-DOS programs.
SHARE Installs support for file sharing and locking capabilities.
SHIFT Changes the position of replaceable parameters in a batch program.
SHUTDOWN Shutdown the computer from the MS-DOS prompt.
SMARTDRV Create a disk cache in conventional memory or extended memory.
SORT Sorts the input and displays the output to the screen.
START Start a separate window in Windows from the MS-DOS prompt.
SUBST Substitute a folder on your computer for another drive letter.
SWITCHES Remove add functions from MS-DOS.
SYS Transfer system files to disk drive.
TELNET Telnet to another computer / device from the prompt.
TIME View or modify the system time.
TITLE Change the title of their MS-DOS window.
TRACERT Visually view a network packets route across a network.
TREE View a visual tree of the hard disk drive.
TYPE Display the contents of a file.
UNDELETE Undelete a file that has been deleted.
UNFORMAT Unformat a hard disk drive.
UNLOCK Unlock a disk drive.
VER Display the version information.
VERIFY Enables or disables the feature to determine if files have been written properly.
VOL Displays the volume information about the designated drive.
XCOPY Copy multiple files, directories, and/or drives from one location to another.
TRUENAME When placed before a file, will display the whole directory in which it exists
TASKKILL It allows you to kill those unneeded or locked up applications

Run Commands To Access The Control Panel

Add/Remove Programs control appwiz.cpl
Date/Time Properties control timedate.cpl
Display Properties control desk.cpl
FindFast control findfast.cpl
Fonts Folder control fonts
Internet Properties control inetcpl.cpl
Keyboard Properties control main.cpl keyboard
Mouse Properties control main.cpl
Multimedia Properties control mmsys.cpl
Network Properties control netcpl.cpl
Password Properties control password.cpl
Printers Folder control printers
Sound Properties control mmsys.cpl sounds
System Properties control sysdm.cp

Run Commands:

compmgmt.msc - Computer management
devmgmt.msc - Device manager
diskmgmt.msc - Disk management
dfrg.msc - Disk defrag
eventvwr.msc - Event viewer
fsmgmt.msc - Shared folders
gpedit.msc - Group policies
lusrmgr.msc - Local users and groups
perfmon.msc - Performance monitor
rsop.msc - Resultant set of policies
secpol.msc - Local security settings
services.msc - Various Services
msconfig - System Configuration Utility
regedit - Registry Editor
msinfo32 _ System Information
sysedit _ System Edit
win.ini _ windows loading information(also system.ini)
winver _ Shows current version of windows
mailto: _ Opens default email client
command _ Opens command prompt

Windows XP Shortcuts:

ALT+- (ALT+hyphen) Displays the Multiple Document Interface (MDI) child window's System menu
ALT+ENTER View properties for the selected item
ALT+ESC Cycle through items in the order they were opened
ALT+F4 Close the active item, or quit the active program
ALT+SPACEBAR Display the System menu for the active window
ALT+TAB Switch between open items
ALT+Underlined letter Display the corresponding menu
BACKSPACE View the folder one level up in My Computer or Windows Explorer
CTRL+A Select all
CTRL+B Bold
CTRL+C Copy
CTRL+I Italics
CTRL+O Open an item
CTRL+U Underline
CTRL+V Paste
CTRL+X Cut
CTRL+Z Undo
CTRL+F4 Close the active document
CTRL while dragging Copy selected item
CTRL+SHIFT while dragging Create shortcut to selected iteM
CTRL+RIGHT ARROW Move the insertion point to the beginning of the next word
CTRL+LEFT ARROW Move the insertion point to the beginning of the previous word
CTRL+DOWN ARROW Move the insertion point to the beginning of the next paragraph
CTRL+UP ARROW Move the insertion point to the beginning of the previous paragraph
SHIFT+DELETE Delete selected item permanently without placing the item in the Recycle Bin
ESC Cancel the current task
F1 Displays Help
F2 Rename selected item
F3 Search for a file or folder
F4 Display the Address bar list in My Computer or Windows Explorer
F5 Refresh the active window
F6 Cycle through screen elements in a window or on the desktop
F10 Activate the menu bar in the active program
SHIFT+F10 Display the shortcut menu for the selected item
CTRL+ESC Display the Start menu
SHIFT+CTRL+ESC Launches Task Manager
SHIFT when you insert a CD Prevent the CD from automatically playing
WIN Display or hide the Start menu
WIN+BREAK Display the System Properties dialog box
WIN+D Minimizes all Windows and shows the Desktop
WIN+E Open Windows Explorer
WIN+F Search for a file or folder
WIN+F+CTRL Search for computers
WIN+L Locks the desktop
WIN+M Minimize or restore all windows
WIN+R Open the Run dialog box
WIN+TAB Switch between open items