Jump to content

run batch as part of autoit executable


Briandr
 Share

Recommended Posts

Hi,

I think this can be done, but how would I convert the batch code below into autoit code and then run it silently?

REM Get the Altiris Agent install path
FOR /F "tokens=2*" %%A IN ('REG.EXE QUERY "HKLMSoftwareAltirisAltiris Agent" /V "installdir"') DO SET AgentDir=%%B
set tempbat=%temp%AgentClean.bat"

REM Create temporary batch file to execute while the agent restarts
echo "%AgentDir%aexagentutil" /stop > %tempbat%
echo rmdir "%AgentDir%TaskManagementcache" /s /q >> %tempbat%
echo rmdir "%AgentDir%TaskManagementstatus" /s /q >> %tempbat%
echo rmdir "%AgentDir%TaskManagementstatusXml" /s /q >> %tempbat%
REM echo rmdir "%AgentDir%TaskManagementlti" /s /q >> %tempbat%      -- remove away the REM, from this line only if you are running on 7.1 and above
echo ping localhost -n 30 >> %tempbat%
echo "%AgentDir%aexagentutil" /start >> %tempbat%
echo exit >> %tempbat%

REM Executes temporary batch file
start "" /MIN %tempbat%
 
Thanks.
Link to comment
Share on other sites

  • Moderators

Hi, Briandr. Here are some hints:

FOR /F "tokens=2*" %%A IN ('REG.EXE QUERY "HKLM\Software\Altiris\Altiris Agent" /V "installdir"') DO SET AgentDir=%%B
    ;Look at Registry Management in the help file 
 
 set tempbat=%temp%\AgentClean.bat"
    ;This is just a variable, $tempbat = <path>
 
 echo "%AgentDir%\aexagentutil" /stop > %tempbat%
    ;Look at RunWait or ShellExecuteWait in the help file
    
 echo rmdir "%AgentDir%\TaskManagement\cache" /s /q >> %tempbat%
 echo rmdir "%AgentDir%\TaskManagement\status" /s /q >> %tempbat%
 echo rmdir "%AgentDir%\TaskManagement\statusXml" /s /q >> %tempbat%
 REM echo rmdir "%AgentDir%\TaskManagement\lti" /s /q >> %tempbat%      -- remove away the REM, from this line only if you are running on 7.1 and above
    ;Look at DirRemove in the help file (sensing a pattern?)

echo ping localhost -n 30 >> %tempbat%
    ;Look at Ping in the help file
    
 echo "%AgentDir%\aexagentutil" /start >> %tempbat%
    ;Look at RunWait or ShellExecuteWait in the help file
    
 start "" /MIN %tempbat%
    ;Look at RunWait or ShellExecuteWait in the help file
Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...