So, I am finding a lot on >NUL, which redirects standard output to NULL, but I have run across

set /p "=VARNAME"<NUL

and have found no documentation on it whatsoever.

So far, what I've found is that it adds a carriage return (at least that is the observed behavior) as when I remove it I have to press enter for each iteration of the script found in an answer here: get driver version via command line Windows

Can anyone help me understand what this is, or better yet, where there is documentation on what this is actually doing?


<nul simply redirects standard input to NUL, effectively disabling input. Using it with set /p is a common hack used to print information to the screen without issuing a newline.

For example:

set /p "=This prints everything " <nul
set /p "=on one line." <nul


This prints everything on one line.

Note that the space between "everything" and "on" is put at the end of the first line instead of the beginning of the second because leading white space is typically stripped by SET /P.

  • Thank you. So, it was exactly along the lines of resulting behavior that I expected... And fills in the how. – Thumper May 3 '14 at 6:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.