Solved nul in a batch variable

December 5, 2013 at 08:29:53
Specs: Windows 7
how do you add >nul to a variable... what im doing is im trying to save a variable that includes set Example=ping localhost -n 1 >nul but it completely disregards the >nul... I know that obviously I could do %Example% >nul but im trying to save the variable Example to another file so doing %Example% >nul will just get rid of that line... so how would I have ping localhost -n 1 >nul show up in the file?

See More: nul in a batch variable

Report •

December 5, 2013 at 10:03:10
✔ Best Answer
Prefix the > with the escape character ^ i.e.

set Example=ping localhost -n 1 ^>nul

message edited by IVO

Report •
Related Solutions

Ask Question