Location

WWW

Interests

I have this button in an app I am building:
When you click it, it then opens a FileOpenDialog() I select and XML, then it asks for a name input, enter the name, then it should run the following code:
schtasks.exe /create /tn XXXX-task /XML C:\WBRESO~1\WB-LOO~1\TESTIN~1.XML
It works when I put it in the CMD and run it, I get SUCCESS! and the new task has been created in Task Scheduler.
C:\Users\vivaed>schtasks.exe /create /tn XXXX /xml C:\WBRESO~1\WB-LOO~1\TESTIN~1.XML
SUCCESS: The scheduled task "XXXX" has successfully been created.
But when I run it in:
(This is just a snippet of the code, there is a lot more)
#include <AutoItConstants.au3>
Global $wbResources = 'C:\"WB Resources"\WB-LoopChecker\'
Case $Button4
$getXML = FileOpenDialog("Find task to import", $wbResources ,"XML (*.xml)")
If @error Then
; Display the error message.
MsgBox($MB_SYSTEMMODAL, "", "No file was selected.")
Else
Local $taskName = InputBox("Name this task","File: " & @CRLF & $getXML & @CRLF & "Name this task:" & @CRLF,"XXXX-task")
$schedTask = 'schtasks.exe /create /tn ' & $taskName & ' /XML ' & FileGetShortName($getXML)
Run(@ComSpec & " /c " & $schedTask, @SW_HIDE)
ConsoleWrite($wbResources & @CRLF)
ConsoleWrite($schedTask & @CRLF)
EndIf
Here I dont get any errors but the when I refresh the Task Scheduler, there is no new task....