0

I got this bat file from Stackoverflow that someone had posted back in 2014 but it will not output any info to the filename?

The file is created but without any info.....

can anyone please help, trying to record the ping output every 1 minute on a windows 7 machine.

@ECHO off set IPADDRESS=192.168.0.1 set INTERVAL=60 :PINGINTERVAL ping %IPADDRESS% -n 1 >> filename.txt timeout %INTERVAL% GOTO PINGINTERVAL 
4
  • superuser.com Commented Mar 10, 2015 at 11:27
  • Try taking off the @ECHO off to see what it's doing. Commented Mar 10, 2015 at 11:30
  • It just outputs the following: :\Users\user\Desktop>set IPADDRESS=192.168.4.254 C:\Users\user\Desktop>set INTERVAL=60 C:\Users\user\Desktop>ping 192.168.4.254 -n 1 1>>filename.txt C:\Users\user\Desktop>set IPADDRESS=192.168.4.254 C:\Users\user\Desktop>set INTERVAL=60 C:\Users\user\Desktop>ping 192.168.4.254 -n 1 1>>filename.txt C:\Users\user\Desktop>set IPADDRESS=192.168.4.254 C:\Users\user\Desktop>set INTERVAL=60 Commented Mar 10, 2015 at 11:38
  • superuser.com/questions/345214/… Commented Oct 8, 2017 at 13:08

2 Answers 2

1

Your batch file is called ping.bat or ping.cmd and is calling itself. Rename the batch file or replace ping %IPADDRESS% ... with ping.exe %IPADDRESS% ...

Sign up to request clarification or add additional context in comments.

Comments

0

The "echo off" is ok. This will only omit output from the script, not from the "ping" app.

I think the output is created in an unexpected location. Add the following lines at the beginning of the script to verify the current folder.

@echo %cd%
pause

Or simply specify the full path like so:
  >> d:\fullpath\filename.txt

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.