Hello Experts Exchange
I have a windows server 2008 machine and I'm trying to run a batch file with logging in it, but every time I run the file I get Access is Denied. I can run other Bat files and they work OK, I think it error at the point it creates a new log file.
Here is the code.
@REM *** START: Turns logging on ***
if "%~1" == "NOWLOGGING" goto NowLogging
set SchedulesLogFile=%~n0 - %date:/=-% %time::=_%.txt
set SchedulesLogFile=%~n0 - %RANDOM%.txt
%0 "NOWLOGGING" > "%SchedulesLogFile%" 2>&1
@REM *** END: Turns logging on ***
@rem Guts of batch file...
echo [%date% %time%] starting...
echo *** start of actual batch file...
echo *** end of actual batch file...
echo [%date% %time%] ending...
How do I resolve the problem?