Osanda Malith
Osanda Malith

Reputation: 47

How to add "null" to a text file in batch?

I have a problem like this. Suppose I want to write this code to a text file.

echo taskkill /IM wscript.exe /F > null

How can I do it?

Thanks to vendettamit, Matteo Italia and Roger Lipscombe :)

Upvotes: 0

Views: 561

Answers (2)

vendettamit
vendettamit

Reputation: 14677

Try this:

   ECHO taskkill .IM wscript.exe /F ^> null > yourFile.txt

Upvotes: 3

Matteo Italia
Matteo Italia

Reputation: 126787

In batch the caret (^) is the escape character; thus:

echo taskkill /IM wscript.exe /F ^>null >file.txt

by the way, I suppose you meant >NUL (>null will just write the data in a file named null).

Upvotes: 5

Related Questions