Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
hi
how can i create a text file using batch file with date and time in name
eg testThu 02/08/2007 2300.txtand 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 querygetmany -v1 < ipaddr.txt public 1.3.6.1.4.1.x.x.x.x.x.x>>test.txt
Thanks
sandy

The dated file:
::==sandy.bat
@echo off
setLocal EnableDelayedExpansion:: get sys YMD into vars
@echo off
:: YYYY getter
> syyyy.d echo a 100
>> syyyy.d echo mov ah,2a
>> syyyy.d echo int 21
>> syyyy.d echo.
>> syyyy.d echo p=100 2
>> syyyy.d echo n sizeYYYY
>> syyyy.d echo w
>> syyyy.d echo q
debug < syyyy.d > nul
:: OK:: MM getter
> sMM.d echo a 100
>> sMM.d echo mov ah,2a
>> sMM.d echo int 21
>> sMM.d echo mov cx,0
>> sMM.d echo mov cl,dh
>> sMM.d echo.
>> sMM.d echo p=100 4
>> sMM.d echo n sizeMM
>> sMM.d echo w
>> sMM.d echo q
debug < sMM.d > nul
:: OK:: DD getter
> sDD.d echo a 100
>> sDD.d echo mov ah,2a
>> sDD.d echo int 21
>> sDD.d echo mov cx,0
>> sDD.d echo mov cl,dl
>> sDD.d echo.
>> sDD.d echo p=100 4
>> sDD.d echo n sizeDD
>> sDD.d echo w
>> sDD.d echo q
debug < sDD.d > nul
:: OK
del *.dfor %%F in (sizeYYYY sizeMM sizeDD) do call :sub1 %%F
set /p YYYY=<sizeYYYY.#
set /p MM=<sizeMM.#
if %MM% LSS 10 set MM=0%MM%
set /p DD=<sizeDD.#
if %DD% LSS 10 set DD=0%DD%
del size*.*
set YMD=%YYYY%%MM%%DD%
echo YMD=%YMD%
@echo off > test%YMD%.txt
goto :eof:sub1
> %1.# echo %~z1
goto :eof
:: ======================== DONE@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
To process multiple IPs:
::== sandy2.bat
@echo off
setLocal EnableDelayedExpansionfor /f "tokens=* delims= " %%A in (iplist) do (
echo my.exe %%A
)
:: ===== DONE
=====================================
If at first you don't succeed, you're about average.M2

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |