1

I'm new to batch scripts and I don't know what >nul in this self-replicating file code means.Can you explain it please?

copy %0 "new.bat" > nul

2 Answers 2

1

> means: "put the output to..."

nul is a "Nirwana-Device"

so

> nul will send the output of the copycommand to Nirwana, so that it doesn't write to the screen.

You could also write the output to a file with >file.txt

For example try these lines:

echo hello world
echo hello world again >nul
echo hello beautiful world >file.txt 
type file.txt
Sign up to request clarification or add additional context in comments.

Comments

0

Just like what Stephan said, these examples work very well too.

timeout /t 01
timeout /t 01>nul

timeout is a command that is a timer which will countdown (in seconds) the specified number you type (which is 01 in this example) /t simply stands for time.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.