Reputation: 3
I try to type command:
start "xyz" ping xx.xx.xx.xx >> C:\Users\X\Desktop\t\xyz.txt
It creates empty file. What am i missing ? Thanks.
Upvotes: 0
Views: 58
Reputation: 56198
Your problem is, that you redirect the output of start
to the file. You have to "link" the redirection to the cmd
instead.
Either (as Liturgist already answered) by escaping the >>
:
start "xyz" cmd.exe /C ping localhost ^>^>xyz.txt
or by enclosing your "executed string" into quotes:
start "xyz" cmd.exe /C "ping localhost >>xyz.txt"
Upvotes: 1
Reputation: 16256
You need to escape the redirection characters.
start "xyz" cmd.exe /C ping localhost ^>^>xyz.txt
Upvotes: 0