/build/static/layout/Breadcrumb_cap_w.png

Having problems with sleep.exe in a .bat

First, let me apologize for my ignorance, as I have only recently started learning this stuff and I'm still fairly inexperienced at it.
That said here is my problem...

I have a script that will install a piece of software silently (wait while it does so) and then calls the sleep.exe for 30 seconds to wait while the install finalizes the system files. After this it will perform a check to find a .cfg file in those system files and replace it with one that we have made up. After this it will do a system reboot.

My problem is when I run this batch file via being called by the K-box or actually input the batch file into K-Box to be run that way the batch file fails at the sleep.
I have tried using the ping delay and no matter what if it is being run from K-Box the delay breaks the performance of the script and it simply never completes any portion of the script after the sleep.

Does anyone have any ideas as to why this script would be running fine when execute the batch file from the test machine, but when sent from the K-Box the same script fails every time?

Here is the script in case someone can point out the error in my script that is causing the problem.
I had to replace some server info with "location" sorry if that is confusing at all.


cls
@echo.

start /wait msiexec /i "(LOCATION)\REACT! Desktop Player Installer.msi" /qn

"(LOCATION)React Player\sleep.exe" 30

findstr /s /c:"Desktops" "C:\Program Files\REACT! Player\react.cfg" | find "CON_CHANNEL_NAME"
if %ERRORLEVEL% == 1 (
@echo.
@echo need CFG fixed #1
@echo.
copy "(LOCATION)\react.cfg" "C:\Program Files\REACT! Player\react.cfg" /Y
shutdown -r -t 30
goto Quit

)
@echo.
@echo First Line Good - Test 2nd
@echo.
findstr /s /c:"(LOCATION)" "C:\Program Files\REACT! Player\react.cfg"
if %ERRORLEVEL% == 1 (
@echo.
@echo need CFG fixed #2
@echo.
copy "(LOCATION)react.cfg" "C:\Program Files\REACT! Player\react.cfg" /Y
shutdown -r -t 30
)


:Quit

0 Comments   [ + ] Show comments

Answers (2)

Posted by: pjgeutjens 14 years ago
Red Belt
0
start /wait msiexec /i "(LOCATION)\REACT! Desktop Player Installer.msi" /qn

Casey,

the above quoted command tells me your installation is an MSI. If it is an option to you (read: if you have the tools available), you should really look into creating a transform for that MSI (.mst file), incorporating your company specific changes (the CFG file in this case).
In doing so your installation would become as simple as passing along your custom transform to the MSI at install time

As for the actual issue with your script: are you sure the MSI installs successfully when using KBOX? Since you're hiding it I guess (LOCATION) is a network path? It might be a case of the account used when pushing with KBOX (LocalSystem?) not having access to the network folder where the sleep.exe is located. Try copying the exe to the local disk before calling it.

PJ
Posted by: anonymous_9363 14 years ago
Red Belt
0
If you were only to abandon DOS batch and its lack of practically any functionality which is useful in the modern day and embrace a proper scripting language (e.g. VBScript or PowerShell), you could use (in this instance) the WindowsInstaller.Installer object to detect the installed state of the product in a loop. Once the installed state is set, you would exit the loop, open up your config file and loop through its content, checking for the relevant strings and acting accordingly.

I'd buy neither of the "I don't have time" or "It's too hard" arguments.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ