dos batch script to make txt file with date in name

S

SANDY

hi
how can i create a text file using dos batch file with date and time
in name
eg testThu 02/08/2007 2300.txt

and also i want to read a text file which has list of IP address and
execute same command one by one with all the ip address in the file
the command is a snmp query

getmany -v1 < ipaddr.txt public 1.3.6.1.4.1.x.x.x.x.x.x>>test.txt

i tried few things able to put date and time in the file but not in
name
and cant read the input recursively from the ipaddress.txt file

can some one Help

Thanks in advance
sandy
 
P

Pegasus \(MVP\)

SANDY said:
hi
how can i create a text file using dos batch file with date and time
in name
eg testThu 02/08/2007 2300.txt

and also i want to read a text file which has list of IP address and
execute same command one by one with all the ip address in the file
the command is a snmp query

getmany -v1 < ipaddr.txt public 1.3.6.1.4.1.x.x.x.x.x.x>>test.txt

i tried few things able to put date and time in the file but not in
name
and cant read the input recursively from the ipaddress.txt file

can some one Help

Thanks in advance
sandy

Your first question:
copy /y c:\test.txt "c:\%date:/=-% %time::=-%.txt"

Your second question:
@echo off
for /F "tokens=*" %%* in ('type c:\IP.txt') do (
echo IP address=%%*
ping %%*
)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top