Solved How can I turn off output to myfilename.log

Mobile computing solutions Mini itx pfse...
November 1, 2014 at 08:38:31
Specs: Windows XP, HexaCore AMD FX-6100, 1400 MHz (7 x 200) / 4gb DDR
I wonder if someone would be so kind as to help me with a small
problem, it seems big to me because I don't know the answer !

I am using a debug script I found a while ago, but on some
batch files it is required to get user input, I want to run the
batch in debug mode to output all echo's to a myfilename.bat
as with the following code, BUT when a certain part of the
batch file is reached I want to return output back to the
screen to give out prompts to the user before going back
into debug mode.

So what command is the opposite of echo's to a file ?

Michelle

:: -------------------------------
echo ERROR TEST LOG FLAG
IF NOT %1!==/go! %0 /go 1>C:\state\%~n0.log 2>&1
SHIFT

ECHO %1 %2 %3 %4 %5
:: -------------------------------

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://tinyurl.com/pnenqgb


See More: How can I turn off output to myfilename.log

Report •


#1
November 1, 2014 at 11:46:38
✔ Best Answer
OK I have been experimenting with this, it's a bit ADD HOC and messy
as I am still playing around with the code, on some cycles it will say a
debug has already accured today but if you run it on a half minute cycles
it should do the debug run, it is meant to do self checking for errors so
the are lines in it with error message lines for it to detect.

:: Begin TEST.BAT

@echo off
setlocal enabledelayedexpansion
:: ###############################################
set state=C:\State\status.txt
if not exist debugrun set mybat=%~n0
:repeat

call :today
if %Day%==01 (goto checkd) else (set debug=no&&goto checkn)
set this-bat=0
:checkd
echo Minute: %Minute%
pathping 127.0.0.1 -n -q 1 -p 5000 >nul 2>&1
cls
:: ###############################################
if exist "C:\State\runday.tmp" set /P this-bat=<"C:\State\runday.tmp"
if "%this-bat%"=="THIS_%~n0.bat %Day%:%Minute%" (echo WE ALREADY DID A DEBUG TODAY&&set debug=no) else (echo DEBUGGING IN PROGRESS&&set debug=yes)
> "C:\State\runday.tmp" echo THIS_%~n0.bat %Day%:%Minute%
:: ###############################################
echo.
echo this-bat = %this-bat%
echo.
echo debug = %debug%
echo.
pathping 127.0.0.1 -n -q 1 -p 5000 >nul 2>&1
cls

:: ###############################################

if exist debugrun set choice=is not recognized
if exist debugrun goto noask

:: ###############################################
:: set /P choice=:Keywords^>
:noask

echo choice:%choice%
echo.
echo This Batch Name: %mybat%.bat
echo.
if %debug%==no goto donerr

pathping 127.0.0.1 -n -q 1 -p 5000 >nul 2>&1
cls
echo now the risky part
echo.
pathping 127.0.0.1 -n -q 1 -p 5000 >nul 2>&1
echo.
cls

:: +++++++++++++++++++++++++++++++++++++++++++++++ /go 1&2 < echo 2<&1
if not exist debugrun goto okec
echo this line is the one to fix ....

IF %1!==/go! %0 echo <0 <&1
SHIFT

echo ERROR TEST LOG FLAG OFF ?
:okec
:: +++++++++++++++++++++++++++++++++++++++++++++++
@echo off
:: echo THIS LINE SHOULD BE OUTPUT TO SCREEN
pathping 127.0.0.1 -n -q 1 -p 5000 >nul 2>&1
cls
:: ###############################################
If exist debugrun goto checkn
:selftst
> debugrun echo self test

echo ERROR TEST LOG FLAG ON
IF NOT %1!==/go! %0 /go 1>C:\state\%mybat%.log 2>&1
SHIFT

ECHO %1 %2 %3 %4 %5

pathping 127.0.0.1 -n -q 1 -p 5000 >nul 2>&1
:checkn
:: ###############################################
@echo on
set choice=is not recognized
echo running in debug mode %debug%
echo THIS LINE SHOULD BE OUTPUT TO FILE
@echo off
:: ###############################################
:: @@@@@@@@@@@@ S SELF TESTING BATCH @@@@@@@@@@@@@
set erlogs="C:\state\%mybat%.log"
echo PATH TO LOG: %erlogs%
if exist %erlogs% (goto errlog) else (goto donerr)
:errlog
>nul find "%choice%" %erlogs% && (
> %state% echo We found BATCH FILE ERRORS Please Send %mybat%.log to Chelley %time%.
if %debug%==no pause
start /SEPARATE notepad %erlogs%
goto donerr
) || (
> %state% echo We did NOT find ANY BATCH FILE ERRORS %time%.
goto donerr
)

@echo off
:: -----------------------------------------------

pathping 127.0.0.1 -n -q 1 -p 5000 >nul 2>&1

:: @@@@@@@@@@@@ E SELF TESTING BATCH @@@@@@@@@@@@@

echo WAITING FOR LOG REVIEW PLEASE CHECK LOG BEFORE CONTINUING
echo.
pathping 127.0.0.1 -n -q 1 -p 8000 >nul 2>&1

if %debug%==yes goto repeat
:donerr
goto done

:today
:: ------------- FINDING UNIVERSAL DATE FORMAT ----------------
Set _Date=%date%
If "%_Date%A" LSS "A" (Set _NumTok=1-3) Else (Set _NumTok=2-4)
:: Default Delimiter of TAB and Space are used
For /F "TOKENS=2*" %%A In ('REG QUERY "HKCU\Control Panel\International" /v iDate') Do Set _iDate=%%B
For /F "TOKENS=2*" %%A In ('REG QUERY "HKCU\Control Panel\International" /v sDate') Do Set _sDate=%%B
IF %_iDate%==0 For /F "TOKENS=%_NumTok% DELIMS=%_sDate% " %%B In ("%_Date%") Do Set _fdate=%%D%%B%%C
IF %_iDate%==1 For /F "TOKENS=%_NumTok% DELIMS=%_sDate% " %%B In ("%_Date%") Do Set _fdate=%%D%%C%%B
IF %_iDate%==2 For /F "TOKENS=%_NumTok% DELIMS=%_sDate% " %%B In ("%_Date%") Do Set _fdate=%%B%%C%%D
:: -----------------------------------------------------------
Set Day=%_fdate:~6,2%
Set Month=%_fdate:~4,2%
Set Year=%_fdate:~0,4%
set YEAR2DIG=%_fdate:~2,2%
:: -----------------------------------------------------------
@For /F "tokens=1,2,3,4 delims=: " %%A in ('Time /t') do @(
Set Hour=%%A
Set Minute=%%B
)

:: -----------------------------------------------------------
goto end
:done
echo BATCH COMPLETED SUCCESSFULLY
pathping 127.0.0.1 -n -q 1 -p 8000 >nul 2>&1
if exist debugrun del debugrun
if exist *.log del /y *.log
endlocal
:end
cls

:: End TEST.BAT

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://tinyurl.com/pnenqgb

message edited by Ortorea


Report •
Related Solutions


Ask Question