0
I was trying to add a tracert command to a .bat file.
At the cmd.exe I was writing:
tracert 111.111.111.111 > desktop\tracert.txt
and it ran ok. I've created a bat file like this:
::@echo off
Cd C:\
cls
echo %DATE%
echo %TIME%
set datetimef=%date:~-4%_%date:~3,2%_%date:~0,2%__%time:~0,2%_%time:~3,2%_%time:~6,2%
echo %datetimef%
::2013_04_20__13_01_47
::tracert 111.111.111.111 > desktop\Tracert_IP1_%datetimef%.txt
tracert 111.111.111.111 > desktop\tracert.txt
The idea is to add the data to filename, I also would like to write it inside the tracert.txt, but I dont know how.
Code result:
C:\>echo 20/04/2013
20/04/2013
C:\>echo 14:18:12,44
14:18:12,44
C:\>set datetimef=2013_04_20__14_18_12
C:\>echo 2013_04_20__14_18_12
2013_04_20__14_18_12
**C:\>tracert 111.111.111.111 1>desktop\tracert.txt**
**The system cannot find the path specified**
Why is it adding "1" before the ">" and removing the space between ">" and "desktop"?
Anyway, I tried to run the tracert
command again directly at the cmd but now it is giving me the same error message as the bat file: The system cannot find the path specified
Edit 1: Well, the problem with the path not find is because I've changed the cmd path using "cd" command, than the desktop folder was just not found! I'm embarrassed! Sorry guys.. Thanks for the replays about the "1"s and disapearing withe spaces.
1To remove all ambiguity why not specify the full path, with quotes if required? – Karan – 2013-04-20T17:34:00.780
I'd probably use %USERPROFILE%\Desktop – unknownprotocol – 2013-04-20T19:35:11.133
You are right! Dumb problem.. sorry – Pedro77 – 2013-04-21T21:54:28.367