3
1
:START
echo %date% %time% && ping -n 1 192.168.1.1 >> pingReport.txt 2>&1
echo %date% %time% && ping -n 1 192.168.1.2 >> pingReport.txt 2>&1
echo %date% %time% && ping -n 1 192.168.1.3 >> pingReport.txt 2>&1
echo %date% %time% && ping -n 1 192.168.1.4 >> pingReport.txt 2>&1
goto START
This echos Date and time on my screen only, but not into the file.
How can I get date and time in the txt file too?
What OS and/or shell is this? The
2>&1
looks *nix-esque, but the use of%date%
and%time%
hints at a Microsoft OS. The answer will likely be different depending on what OS and shell you want it for. – a CVn – 2013-10-02T12:19:30.597