Jump to content

Hi all,

 

I can't quite figure out why when people run my batch it sometimes doesn't produce a log file.

 

My only view on this is that multiple people might be running it at the same time. Would this cause issues and if possible, how can I fix this?

 

Appreciate any help.

 

Below is the code for the batch file.

 

Spoiler

@ECHO OFF
if /I "%COMPUTERNAME:~0,6%"=="xxx" (goto :citrix) ELSE (goto :B)

:B
SET MyProcess=cmd.exe
@ECHO OFF 
TASKLIST | FINDSTR /I "cwin32.exe" >nul 2>&1
@ECHO OFF
IF ERRORLEVEL 1 (GOTO :StartScripts) ELSE (ECHO Caseware is currently open. Press any key once Caseware is CLOSED.)
Timeout /T 120
GOTO :B 

:StartScripts 
ECHO Installing... During this time, take a moment to think of your lovely IT department.
CALL "xxx\xxx.bat"
ECHO %username% %time% %date% %computername% > "log\%username%.txt"
cls
ECHO Install finished. Have a lovely day!
echo.
color 0A
ECHO IT Dept
echo.
PAUSE
GOTO EOF

:citrix
color 0B
@ECHO OFF
cls
color 0A
ECHO This installation will not run in Citrix. To proceed, please close Citrix and run again.
echo.
echo.
pause
goto eof

 

 

Thanks.

My Gaming Rig;  Motherboard - ASUS Maximus VI Hero | CPU - Intel i5 4670k @4.5Ghz 1.25v | GPU - GIGABYTE GTX 980 @Stock | RAM -  16GB Corsair Vengeance @1866Mhz | CPU Cooler - Corsair H100i | Storage #1 - Samsung 840 Basic 250GB SSD | Storage #2 - Sandisk II 480GB SSD | Storage #3 - 2TB 7200rpm 64mb HDDPSU - Corsair HX750 | Case - Fractal Design R4 |

Link to comment
https://linustechtips.com/topic/805847-batch-file-logging-issue/
Share on other sites

Link to post
Share on other sites

9 hours ago, elpiop said:

maybe the user does not have write access to the directory? 

It's hit and miss. I've had users which it logged fine but others it didn't seem to log. 

 

I'm also starting to think it's an issue beyond cmd. 

My Gaming Rig;  Motherboard - ASUS Maximus VI Hero | CPU - Intel i5 4670k @4.5Ghz 1.25v | GPU - GIGABYTE GTX 980 @Stock | RAM -  16GB Corsair Vengeance @1866Mhz | CPU Cooler - Corsair H100i | Storage #1 - Samsung 840 Basic 250GB SSD | Storage #2 - Sandisk II 480GB SSD | Storage #3 - 2TB 7200rpm 64mb HDDPSU - Corsair HX750 | Case - Fractal Design R4 |

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×