Translate

Total Pageviews

Quits the CMD.EXE program

Exit the CMD.EXE program 

C:\Users\somet>exit /?

Quits the CMD.EXE program (command interpreter) or the current batch

script.


EXIT [/B] [exitCode]


  /B          specifies exiting the current batch script instead of

              CMD.EXE.  If executed from outside a batch script, it

              will quit CMD.EXE


  exitCode specifies a numeric number.  if /B is specified, sets

              ERRORLEVEL that number.  If quitting CMD.EXE, sets the process

              exit code with that number.

Code of shutdown in CMD

 Code of SHUTDOWN in CMD

C:\Users\somet>shutdown /?

Usage: shutdown [/i | /l | /s | /sg | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/soft] [/fw] [/f]

    [/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]


    No args    Display help. This is the same as typing /?.

    /?         Display help. This is the same as not typing any options.

    /i         Display the graphical user interface (GUI).

               This must be the first option.

    /l         Log off. This cannot be used with /m or /d options.

    /s         Shutdown the computer.

    /sg        Shutdown the computer. On the next boot, if Automatic Restart Sign-On

               is enabled, automatically sign in and lock the last interactive user.

               After signing in, restart any registered applications.

    /r         Full shutdown and restart the computer.

    /g         Full shutdown and restart the computer. After the system is rebooted,

               if Automatic Restart Sign-On is enabled, automatically sign in and

               lock the last interactive user.

               After signing in, restart any registered applications.

    /a         Abort a system shutdown.

               This can only be used during the time-out period.

               Combine with /fw to clear any pending boots to the firmware.

    /p         Turn off the local computer with no time-out or warning.

               Can be used with /d and /f options.

    /h         Hibernate the local computer.

               Can be used with the /f option.

    /hybrid    Performs a shutdown of the computer and prepares it for fast startup.

               Must be used with /s option.

    /fw        Combine with a shutdown option to cause the next boot to go to the

               firmware user interface.

    /e         Document the reason for an unexpected shutdown of a computer.

    /o         Go to the advanced boot options menu and restart the computer.

               Must be used with /r option.

    /m \\computer Specify the target computer.

    /t xxx     Set the time-out period before shutdown to xxx seconds.

               The valid range is 0-315360000 (10 years), with a default of 30.

               If the timeout period is greater than 0, the /f parameter is

               implied.

    /c "comment" Comment on the reason for the restart or shutdown.

               A maximum of 512 characters is allowed.

    /f         Force running applications to close without forewarning users.

               The /f parameter is implied when a value greater than 0 is

               specified for the /t parameter.

    /d [p|u:]xx:yy  Provide the reason for the restart or shutdown.

               p indicates that the restart or shutdown is planned.

               u indicates that the reason is user defined.

               If neither p nor u is specified the restart or shutdown is

               unplanned.

               xx is the major reason number (positive integer less than 256).

               yy is the minor reason number (positive integer less than 65536).


Reasons on this computer:

(E = Expected U = Unexpected P = planned, C = customer defined)

Type    Major   Minor   Title


 U      0       0       Other (Unplanned)

E       0       0       Other (Unplanned)

E P     0       0       Other (Planned)

 U      0       5       Other Failure: System Unresponsive

E       1       1       Hardware: Maintenance (Unplanned)

E P     1       1       Hardware: Maintenance (Planned)

E       1       2       Hardware: Installation (Unplanned)

E P     1       2       Hardware: Installation (Planned)

E       2       2       Operating System: Recovery (Unplanned)

E P     2       2       Operating System: Recovery (Planned)

  P     2       3       Operating System: Upgrade (Planned)

E       2       4       Operating System: Reconfiguration (Unplanned)

E P     2       4       Operating System: Reconfiguration (Planned)

  P     2       16      Operating System: Service pack (Planned)

        2       17      Operating System: Hot fix (Unplanned)

  P     2       17      Operating System: Hot fix (Planned)

        2       18      Operating System: Security fix (Unplanned)

  P     2       18      Operating System: Security fix (Planned)

E       4       1       Application: Maintenance (Unplanned)

E P     4       1       Application: Maintenance (Planned)

E P     4       2       Application: Installation (Planned)

E       4       5       Application: Unresponsive

E       4       6       Application: Unstable

 U      5       15      System Failure: Stop error

 U      5       19      Security issue (Unplanned)

E       5       19      Security issue (Unplanned)

E P     5       19      Security issue (Planned)

E       5       20      Loss of network connectivity (Unplanned)

 U      6       11      Power Failure: Cord Unplugged

 U      6       12      Power Failure: Environment

  P     7       0       Legacy API shutdown

Code of start in CMD

 Code of START in CMD

C:\Users\somet>start /?

Starts a separate window to run a specified program or command.


START ["title"] [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]

      [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]

      [/NODE <NUMA node>] [/AFFINITY <hex affinity mask>] [/WAIT] [/B]

      [command/program] [parameters]


    "title"     Title to display in the window title bar.

    path        Starting directory.

    B           Start the application without creating a new window. The

                application has ^C handling ignored. Unless the application

                enables ^C processing, ^Break is the only way to interrupt

                the application.

    I           The new environment will be the original environment passed

                to the cmd.exe and not the current environment.

    MIN         Start window minimized.

    MAX         Start window maximized.

    SEPARATE    Start 16-bit Windows program in separate memory space.

    SHARED      Start a 16-bit Windows program in shared memory space.

    LOW         Start application in the IDLE priority class.

    NORMAL      Start application in the NORMAL priority class.

    HIGH        Start application in the HIGH priority class.

    REALTIME    Start application in the REALTIME priority class.

    ABOVENORMAL Start application in the ABOVENORMAL priority class.

    BELOWNORMAL Start application in the BELOWNORMAL priority class.

    NODE        Specifies the preferred Non-Uniform Memory Architecture (NUMA)

                node as a decimal integer.

    AFFINITY    Specifies the processor affinity mask as a hexadecimal number.

                The process is restricted to running on these processors.


                The affinity mask is interpreted differently when /AFFINITY and

                /NODE are combined.  Specify the affinity mask as if the NUMA

                node's processor mask is right-shifted to begin at bit zero.

                The process is restricted to running on those processors in

                common between the specified affinity mask and the NUMA node.

                If no processors are in common, the process is restricted to

                running on the specified NUMA node.

    WAIT        Start the application and wait for it to terminate.

    command/program

                If it is an internal cmd command or a batch file then

                the command processor is run with the /K switch to cmd.exe.

                This means that the window will remain after the command

                has been run.


                If it is not an internal cmd command or batch file then

                it is a program and will run as either a windowed application

                or a console application.


    parameters  These are the parameters passed to the command/program.


NOTE: The SEPARATE and SHARED options are not supported on 64-bit platforms.


Specifying /NODE allows processes to be created in a way that leverages memory

locality on NUMA systems.  For example, two processes that communicate with

each other heavily through shared memory can be created to share the same

preferred NUMA node in order to minimize memory latencies.  They allocate

memory from the same NUMA node when possible, and they are free to run on

processors outside the specified node.


    start /NODE 1 application1.exe

    start /NODE 1 application2.exe


These two processes can be further constrained to run on specific processors

within the same NUMA node.  In the following example, application1 runs on the

low-order two processors of the node, while application2 runs on the next two

processors of the node.  This example assumes the specified node has at least

four logical processors.  Note that the node number can be changed to any valid

node number for that computer without having to change the affinity mask.


    start /NODE 1 /AFFINITY 0x3 application1.exe

    start /NODE 1 /AFFINITY 0xc application2.exe


If Command Extensions are enabled, external command invocation

through the command line or the START command changes as follows:


non-executable files may be invoked through their file association just

    by typing the name of the file as a command.  (e.g.  WORD.DOC would

    launch the application associated with the .DOC file extension).

    See the ASSOC and FTYPE commands for how to create these

    associations from within a command script.


When executing an application that is a 32-bit GUI application, CMD.EXE

    does not wait for the application to terminate before returning to

    the command prompt.  This new behavior does NOT occur if executing

    within a command script.


When executing a command line whose first token is the string "CMD "

    without an extension or path qualifier, then "CMD" is replaced with

    the value of the COMSPEC variable.  This prevents picking up CMD.EXE

    from the current directory.


When executing a command line whose first token does NOT contain an

    extension, then CMD.EXE uses the value of the PATHEXT

    environment variable to determine which extensions to look for

    and in what order.  The default value for the PATHEXT variable

    is:


        .COM;.EXE;.BAT;.CMD


    Notice the syntax is the same as the PATH variable, with

    semicolons separating the different elements.


When searching for an executable, if there is no match on any extension,

then looks to see if the name matches a directory name.  If it does, the

START command launches the Explorer on that path.  If done from the

command line, it is the equivalent to doing a CD /D to that path.

Code of move in CMD

Code of MOVE in CMD

C:\Users\somet>move /?

Moves files and renames files and directories.


To move one or more files:

MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination


To rename a directory:

MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2


  [drive:][path]filename1 Specifies the location and name of the file

                          or files you want to move.

  destination             Specifies the new location of the file. The destination

                          can consist of a drive letter and colon, a

                          directory name, or a combination. If you are moving

                          only one file, you can also include a filename if

                          you want to rename the file when you move it.

  [drive:][path]dirname1  Specifies the directory you want to rename.

  dirname2                Specifies the new name of the directory.


  /Y                      Suppresses prompting to confirm you want to

                          overwrite an existing destination file.

  /-Y                     Causes prompting to confirm you want to overwrite

                          an existing destination file.


The switch /Y may be present in the COPYCMD environment variable.

This may be overridden with /-Y on the command line.  The default is

to prompt on overwrites unless the MOVE command is being executed from

within a batch script.

Code of ipconfig in CMD

Code of IPCONFIG in CMD

C:\Users\somet>ipconfig /?

USAGE:

    ipconfig [/allcompartments] [/? | /all |

                                 /renew [adapter] | /release [adapter] |

                                 /renew6 [adapter] | /release6 [adapter] |

                                 /flushdns | /displaydns | /registerdns |

                                 /showclassid adapter |

                                 /setclassid adapter [classid] |

                                 /showclassid6 adapter |

                                 /setclassid6 adapter [classid] ]

where

    adapter             Connection name

                       (wildcard characters * and ? allowed, see examples)

    Options:

       /?               Display this help message

       /all             Display full configuration information.

       /release         Release the IPv4 address for the specified adapter.

       /release6        Release the IPv6 address for the specified adapter.

       /renew           Renew the IPv4 address for the specified adapter.

       /renew6          Renew the IPv6 address for the specified adapter.

       /flushdns        Purges the DNS Resolver cache.

       /registerdns     Refreshes all DHCP leases and re-registers DNS names

       /displaydns      Display the contents of the DNS Resolver Cache.

       /showclassid     Displays all the dhcp class IDs allowed for adapter.

       /setclassid      Modifies the dhcp class id.

       /showclassid6    Displays all the IPv6 DHCP class IDs allowed for adapter.

       /setclassid6     Modifies the IPv6 DHCP class id.


The default is to display only the IP address, subnet mask and

default gateway for each adapter bound to TCP/IP.


For Release and Renew, if no adapter name is specified, then the IP address

leases for all adapters bound to TCP/IP will be released or renewed.


For Setclassid and Setclassid6, if no ClassId is specified, then the ClassId is removed.


Examples:

    > ipconfig                       ... Show information

    > ipconfig /all                  ... Show detailed information

    > ipconfig /renew                ... renew all adapters

    > ipconfig /renew EL*            ... renew any connection that has its

                                         name starting with EL

    > ipconfig /release *Con*        ... release all matching connections,

                                         eg. "Wired Ethernet Connection 1" or

                                             "Wired Ethernet Connection 2"

    > ipconfig /allcompartments      ... Show information about all

                                         compartments

    > ipconfig /allcompartments /all ... Show detailed information about all

                                         compartments

Code of color in CMD

Code of COLOR in CMD

C:\Users\somet>color /?

Sets the default console foreground and background colors.


COLOR [attr]


  attr        Specifies color attribute of console output


Color attributes are specified by TWO hex digits -- the first

corresponds to the background; the second is the foreground.  Each digit

can be any of the following values:


    0 = Black       8 = Gray

    1 = Blue        9 = Light Blue

    2 = Green       A = Light Green

    3 = Aqua        B = Light Aqua

    4 = Red         C = Light Red

    5 = Purple      D = Light Purple

    6 = Yellow      E = Light Yellow

    7 = White       F = Bright White


If no argument is given, this command restores the color to what it was

when CMD.EXE started.  This value either comes from the current console

window, the /T command line switch, or from the DefaultColor registry

value.


The COLOR command sets ERRORLEVEL to 1 if an attempt is made to execute

the COLOR command with a foreground and background color that is the

same.


Example: "COLOR fc" produces light red on bright white

Code of Copy in CMD

Code of Copy in CMD

C:\Users\somet>copy /?

Copies one or more files to another location.


COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/L] [/A | /B ] source [/A | /B]

     [+ source [/A | /B] [+ ...]] [destination [/A | /B]]


  source       Specifies the file or files to be copied.

  /A           Indicates an ASCII text file.

  /B           Indicates a binary file.

  /D           Allow the destination file to be created decrypted

  destination  Specifies the directory and/or filename for the new file(s).

  /V           Verifies that new files are written correctly.

  /N           Uses a short filename, if available when copying a file with a

               non-8dot3 name.

  /Y           Suppresses prompting to confirm you want to overwrite an

               existing destination file.

  /-Y          Causes prompting to confirm you want to overwrite an

               existing destination file.

  /Z           Copies networked files in restartable mode.

  /L           If the source is a symbolic link, copy the link to the target

               instead of the actual file the source link points to.


The switch /Y may be preset in the COPYCMD environment variable.

This may be overridden with /-Y on the command line.  The default is

to prompt on overwrites unless COPY command is being executed from

within a batch script.


To append files, specify a single file for the destination, but multiple files

for source (using wildcards or file1+file2+file3 format).