Failed to run a batch file using any actions commands!

(imported topic written by SystemAdmin)

Hello All

Actually , i started to get frustrated to run My batch file using any of the common known actions commands ( wait , waithidden , run , runhidden , runquiet )!!!

and the big disaster is that when i test any of these commands on the Fixlet Debugger , it give me successfull response while actually it doesn’t do any thing and the patch not run

Here is my action script

=================================================

delete __appendfile

delete chkcurrdef.bat

appendfile @ECHO OFF

appendfile copy *.fxf antipest.fxf

appendfile find “extract defs” antipest.fxf >temp

appendfile for /f "tokens=2 delims= " %%a in (‘more/e +2^< temp’) do (echo %%a >> temp2)

appendfile for /f “tokens=1” %%a in (‘more temp2’) do set def=%%a

appendfile REG ADD HKLM\Software\Bigfix\Antipest /v Def /t REG_SZ /d %def% /f

appendfile del temp*

move __appendfile “{pathname of parent folder of regapp “BESClient.exe” & “__BESData\BigFix AntiPest\chkcurrdef.bat”}”

wait “{pathname of client folder of site “BESSupport” & “\RunQuiet.exe”}” “{pathname of parent folder of regapp “BESClient.exe” & “__BESData\BigFix AntiPest\chkcurrdef.bat”}”

===================================================

This is the original batch code , all commands are run successfully except the Last command which should run the batch file !

i have tried to replace the last command with the following commands

waithidden/runhidden “{pathname of parent folder of regapp “BESClient.exe” & “__BESData\BigFix AntiPest\chkcurrdef.bat”}”

waithidden cmd.exe “{pathname of parent folder of regapp “BESClient.exe” & “__BESData\BigFix AntiPest\chkcurrdef.bat”}”

and actually when i test any of these commands on the Fixlet debugger , it give me good respose with the execution time , but the batch is not executed !

NB : when i run the batch manually , it run successfully

NB : i have many other batchs files which run normally on the same machine and with the normal commands , so the problem should be in this batch

Thanks in advance for you Help

Ahmed Hamed

(imported comment written by Shlomi91)

Hi Ahmed,

try running wait “{pathname of system folder & “\cmd.exe”}” /c “{pathname of parent folder of regapp “BESClient.exe” & “__BESData\BigFix AntiPest\chkcurrdef.bat”}” or waithidden “{pathname of system folder & “\cmd.exe”}” /c “{pathname of parent folder of regapp “BESClient.exe” & “__BESData\BigFix AntiPest\chkcurrdef.bat”}”

Shlomi

(imported comment written by SystemAdmin)

Hi Shlomi

Unfortunality , the same Result ! , when i try it in the Fixlet debugger , it give me success response ( execution time ) while the batch file didn’t run !

and when i put it in the fixlet action , it complete successfully also without running the batch !

Actually , all evidence say that the wait/run commands unable to run this batch ( i don’t know why )

may be because it output temp files or using “*” symbol !

I hope some one from Bigfix product expert help in this

Thanks

Ahmed Hamed

(imported comment written by BenKus)

Hi Ahmed,

Couple notes to help:

  • The success criteria of the “wait”, “run”, “waithidden”, “runhidden” commands are that the application you are launching worked properly. However, it doesn’t mean that your batch file ran properly (it generally means that cmd.exe or whatever application you specified launched correctly).
  • As Shlomi mentioned, the correct syntax you want to use is cmd.exe /C apptorun.bat. “cmd.exe apptorun.bat” will not work.
  • Runquiet is deprecated and you shouldn’t need to bother with it… It also has strange interactions with batch files… (use runhidden or waithidden instead).
  • The “current working directory” for BigFix actions is always the folder of the source Fixlet (even if you launch a batch file from a different location). Since this is a custom Fixlet, it will probably be in your actionsite or opsite and that might be part of your problem.

Try this and see if it helps:

delete __appendfile
delete chkcurrdef.bat
appendfile @ECHO OFF
appendfile cd "{pathname of parent folder of regapp “BESClient.exe” & “__BESData\BigFix AntiPest”}"
appendfile copy .fxf antipest.fxf
appendfile find “extract defs” antipest.fxf >temp
appendfile for /f "tokens=2 delims= " %%a in (‘more/e +2^< temp’) do (echo %%a >> temp2)
appendfile for /f “tokens=1” %%a in (‘more temp2’) do set def=%%a
appendfile REG ADD HKLM\Software\Bigfix\Antipest /v Def /t REG_SZ /d %def% /f
appendfile del temp

move __appendfile chkcurrdef.bat
// use waithidden instead of wait to suppress the dos box
wait cmd.exe /C chkcurrdef.bat

I am not really clear what/why you are doing with this action so I am not sure if it will really work…

Ben

(imported comment written by SystemAdmin)

Wow , it worked !

it seems that the batch file shoud run from the Default location of the Fixlet site ! ( action site in my case )

any way , Thanks alot for your Help

Hamed