cmd.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sat, 26 Dec 2009 13:06:11 +0200
changeset 261 0332d38237db
parent 216 89e2ee90bc4c
child 350 f7899ef26f6f
permissions -rw-r--r--
Rename ssh article to remote-shell.

-*- outline -*-

* Variables.

Variable name start with letter and underscore, next chars can be letter,
number and underscore. Variable name is case insensitive.

** List of variables.

  cmd> set
...
VAR=VALUE

** Getting.

Write %VAR% in place where you want insert variable VAr value.

** Setting.

  cmd> set /p VAR=VALUE

VAR is variable name, VALUE is value.

** Deleting.

  cmd> set VAR=

VAR is variable name.

** Input from user.

  cmd> set /p VAR=PROMPT

VAR is variable name, PROMPT is displayed prompt.

** Input from file.

  cmd> set /p VAR=<FILE

VAR is variable name, FILE is file name. Sfter executing VAR contain first
line from FILE.

* CMD tricks.

  $ set /p TOOLOUTPUT= < temp.txt

  $ for /f "tokens=*" %%i in ('%~dp0sometool.exe') do set TOOLOUTPUT=%%i

  $ for /f "tokens=1 delims=" %%s in (users.txt) do (echo %%S & command "%%S") >> outputfile.txt