6 posts in this topic
What is the best way to install a .air file with autoit?
So far the programs understand if a usb driver is plugged in and opens the path which holds the .air file and runs it.
I tried to install it using tabs and other keys but that is problematic.
Could be there a solution to install in via command line or something where I can change things like installation location like in the normal installation?
I'm attempting to created a windows task using SCHTASKS, but seem to have my formatting incorrect as a double quote is getting stripped out. How might I correct my code to resolve this dilemma?
#RequireAdmin #include <AutoItConstants.au3> Global $TaskName, $sStartTime, $Program, $ProgramName, $Argument $TaskName = "MyTask" $sStartTime = "15:00" $ProgramName = "\\Server\share\myapp.exe" $Argument = " /verbose" $Program = '"' & $ProgramName & '"' & $Argument & '"' MsgBox(0, "Program with Argument", $Program) Scheduler() Func Scheduler() Local $sCmd, $sStartDate, $sDateTime, $sXtra_Parms, $Result Local $QueryTask = Run("SCHTASKS /QUERY /TN " & $TaskName, "", @SW_HIDE, $STDOUT_CHILD) Local $line = "" If @OSVersion = "WIN_VISTA" Or @OSVersion = "WIN_7" Or @OSVersion = "WIN_8" Or @OSVersion = "WIN_81" Then $sXtra_Parms = " /Z /V1" While 1 $line &= StdoutRead($QueryTask) If @error Then ExitLoop WEnd If $line = "" Then MsgBox(1, "Task Command", 'SCHTASKS /CREATE /TN ' & $TaskName & ' /TR ' & '"' & $Program & '"' & ' /ST ' & $sStartTime & ' /SC ONCE /RU SYSTEM' & $sXtra_Parms) $sCmd = 'SCHTASKS /CREATE /TN ' & $TaskName & ' /TR ' & '"' & $Program & '"' & ' /ST ' & $sStartTime & ' /SC ONCE /RU SYSTEM' & $sXtra_Parms ;$sCmd = 'SCHTASKS /CREATE /TN ' & $TaskName & ' /TR ' & $Program & ' /ST ' & $sStartTime & ' /SC ONCE /RU SYSTEM' & $sXtra_Parms Else $sCmd = 'SCHTASKS /CHANGE /TN ' & $TaskName & ' /ST ' & $sStartTime EndIf $Result = Run($sCmd, "", @SW_HIDE) If $Result > 0 Then MsgBox(64, "Success!!", "The task was successfully created.") Else MsgBox(48, "Sorry...", "There was a problem scheduling this installation, please contact the HelpDesk for assistance.") EndIf EndFunc ;==>Scheduler The task is created with the above code, except the formatting is wrong so I getting an invalid directory error upon run time.
The above creates this command (Serversharemyapp.exe" /verbose) in the task scheduler.
What I'm actually trying to get is ("Serversharemyapp.exe" /verbose)
The first double quote is being stripped out using my faulty code.
Thanks for your time,