cmd.rst
changeset 2540 d699ee7377a4
parent 2539 742921adf64c
equal deleted inserted replaced
2539:742921adf64c 2540:d699ee7377a4
     3 ====================
     3 ====================
     4  CMD Windows shell.
     4  CMD Windows shell.
     5 ====================
     5 ====================
     6 .. contents::
     6 .. contents::
     7    :local:
     7    :local:
       
     8 
       
     9 Defining prompt
       
    10 ===============
       
    11 
       
    12 Set the environmet variable ``PROMPT``, example of ``.reg`` file::
       
    13 
       
    14   [HKEY_CURRENT_USER\Environment]
       
    15   "PROMPT"="cmd# "
       
    16 
       
    17 I embedded current time and directory; also a new line for readability of commands when a current
       
    18 working directory path is too long::
       
    19 
       
    20   [HKEY_CURRENT_USER\Environment]
       
    21   "PROMPT"="$T$S$P$_cmd#$S"
       
    22 
       
    23 CMD has built-in command to modify this env var::
       
    24 
       
    25   prompt "FORMAT"
       
    26 
       
    27 To list available options use ``prompt /?``.
       
    28 
       
    29 Resize a conhost window
       
    30 =======================
       
    31 ::
       
    32 
       
    33   cmd# mode CON: COLS=120 LINES=40
     8 
    34 
     9 Quoting.
    35 Quoting.
    10 ========
    36 ========
    11 
    37 
    12 * Arguments are delimited by white space, which is either a space or a tab.
    38 * Arguments are delimited by white space, which is either a space or a tab.
    77 
   103 
    78   $ for /f "tokens=*" %%i in ('%~dp0sometool.exe') do set TOOLOUTPUT=%%i
   104   $ for /f "tokens=*" %%i in ('%~dp0sometool.exe') do set TOOLOUTPUT=%%i
    79 
   105 
    80   $ for /f "tokens=1 delims=" %%s in (users.txt) do (echo %%S & command "%%S") >> outputfile.txt
   106   $ for /f "tokens=1 delims=" %%s in (users.txt) do (echo %%S & command "%%S") >> outputfile.txt
    81 
   107 
    82 Resize cmd window.
       
    83 ==================
       
    84 ::
       
    85 
       
    86   cmd# mode CON: COLS=120 LINES=40
       
    87 
       
    88 Limits.
   108 Limits.
    89 =======
   109 =======
    90 
   110 
    91 Variable value and one line command string after expansion can not exceed 8191
   111 Variable value and one line command string after expansion can not exceed 8191
    92 characters for Windows XP and later and 2047 for Windows NT, Windows 2000.
   112 characters for Windows XP and later and 2047 for Windows NT, Windows 2000.