'echo' without trailing newline
To echo a text without the writing of the ending newline (like
echo -n under POSIX), type :
echo | set /p="<text>"
<text> is the text to display.
|| trueto reset the errorlevel.
Setting a variable with the result of a command
To put the result of a command in an environment variable, type :
<command> > <file> - set /p <variable>= < <file>
<command>is the command from which you want to retrieve the result,
<variable>the name of the environment variable in which you want to store the result of the above command,
<file>: the name of a temporary file which can be deleted afterwards.
DOS command return value
The return value of a DOS command can be retrieved through
%ERRORLEVEL%. A value other then
0 usually indicates an error.
Copying to clipboard :
… | clip.
There is a way to copy from clipboard, but it involves PowerShell.
Also see Cygwin section.