Question:
What does > and >> mean in batch coding/ files?
Chris K
2008-08-27 15:24:55 UTC
I found this great code i could put in my random event generator code and i need to test it separate first
@echo off
echo.|time|find "Current" >cu##ent.bat
echo set time=%%3> current.bat
call cu##ent.bat
del cu??ent.bat > nul
echo = | choice /c=%time%= temp2.bat > temp1.bat
echo shift>temp2.bat
echo shift>>temp2.bat
echo set RANDOM=%%9>>temp2.bat
call temp1.bat
del temp?.bat > nul
And some of it does not work so i have to modify it. so i needed to know what does > mean and what does >> mean thanks
Three answers:
RPK
2008-08-27 15:51:54 UTC
Redirection Operators



> Writes the command output to a file or a device, such as a printer, instead of the Command Prompt window. It will overwrite an existing file.



< Reads the command input from a file, instead of reading input from the keyboard.



>> Appends the command output to the end of a file without deleting the information that is already in the file. It will create a file if none exists.



Redirecting to "nul" (the null device) just sends the output to nowhere and so just obliterates the output. Prevents it from being shown.
Kookiemon
2008-08-27 15:31:52 UTC
A single > tells Command to send the output to the specified file.



A double > tells Commands to append the output to the specified file.
?
2016-10-28 13:28:06 UTC
you may't do it that way, yet once you've a sub referred to as Auto_Open which will run every time the excel report is open. So, in case you launch the excel report from the batch report your VBA code will run immediately


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...