1

i'm trying to made a batch that run multiples cmd and they made a log file, i already google it but i didn't found any solution about this :(

ping google.com >> 1.txt
ping facebook.com >> 2.txt
ping twitter.com >> 3.txt 

this is an example of what I want to do, start 3 different CMD where a simple ping is made and save a txt (as if were a log)

if I put a start before of the command, it creates the text and the pings, but it doesn't register in the txt file, it shows blank

start ping google.com >> 1.txt
start ping facebook.com >> 2.txt
start ping twitter.com >> 3.txt

basically, I want that all the commands run at the same time in just one batch file, I don't want to wait that the fist command finished and start the next one

  • You can take a look at this ==> [Pinging Multiple PCs and Adding Text](http://stackoverflow.com/questions/38636170/pinging-multiple-pcs-and-adding-text?answertab=active#tab-top) – Hackoo Aug 10 '16 at 03:42

2 Answers2

0

It is trying to redirect the output of start which doesn't have any. Try this

start cmd.exe "/c ping google.com >> 1.txt"
start cmd.exe "/c ping facebook.com >> 2.txt"
start cmd.exe "/c ping twitter.com >> 3.txt"
Patrick Meinecke
  • 3,963
  • 2
  • 18
  • 26
0

You can try this solution :

@echo off
Title Multi Ping Tester
set URLS=www.twitter.com www.google.com www.facebook.com
For %%a in (%URLS%) do call :test_ping %%a
Exit /b
::**********************************************************
:test_ping
cls
If Exist %1.txt Del %1.txt
start cmd.exe "/c ping -4 -a %1 >> %1.txt"                 
Exit /b
::**********************************************************
Hackoo
  • 18,337
  • 3
  • 40
  • 70