| 1. |
Solve : make log of batch file? |
|
Answer» Can you capture the results of a batch file you are currently working with? As you have found out, redirection is an all or nothing proposition. You'll need to go into batchfile and redirect the output of the individual commands but allowing the prompts to continue through to the command area and not the log file. here is the first part of the batch file I'm trying to log. batch: @echo off cls echo configuring current time echo. remthis will get the local time call:gettime hours mins goto END :gettime hh nn setlocal ENABLEEXTENSIONS remthis will set the local time for /f "tokens=5-8 delims=:. " %%a in ('echo/^|time') do ( set hh=%%a&set nn=%%b) if 1%hh% LSS 20 set hh=0%hh% endlocal&set %1=%hh%&set %2=%nn%&goto time :time remputs time in user friendly format set _time=%hours%:%mins% remprompt user to select if task should run now remor a set time :LOOPA cls ECHO. ECHO. ECHO please CHOOSE time ECHO ECHO. ECHO A. ECHO A. current time (%_time%) PLUS 15 minutes for processing ECHO B. set a time to run ECHO. SET Choice= SET /P Choice=Type the letter and PRESS Enter: IF NOT '%Choice%'=='' SET Choice=%Choice:~0,1% IF /I '%Choice%'=='A' GOTO ItemA IF /I '%Choice%'=='B' GOTO ItemB ECHO "%Choice%" is not valid. Please TRY again. ECHO. ping -n 2 localhost > nul GOTO LoopA this is only about a 10th of the batch but it gets to this point and stops because it is waiting for user input. The issue I have is that when I call this batch file from my first batch file this one runs but dose not display or allow me to interact with it. I have got it to work by using the >> "\\server\drive\log\time.log" command after each command I wish to log. I just was trying to just call this batch file log what it dose and then move it to a log file. thanks again, Wayne |
|