I create task with VBS, task create and run on time perfect
dim fso, f, pather, objShell
set objShell = Wscript.CreateObject("WScript.Shell")
Set fso = createObject("Scripting.FileSystemObject")
Set f = fso.GetFile(WScript.ScriptFullName)
pather = fso.GetParentFolderName(f)
controlTask = "schtasks /create /tn ""Controler"" /tr " & CHR(34) & pather & "\myFile.txt" & CHR(34) & " /sc minute /mo 50"
objShell.Run controlTask
And when I try to delete task
Set oShell = WScript.CreateObject("WScript.Shell")
oShell.Run "schtasks /delete /tn ""Controler"" /f"
the task is not deleted. Why is what?
If I create task with direct path to the file ("schtasks /create /tn ""Controler"" /tr ""c:user\meme\myFile.txt"" /sc minute /mo 50"
), task create and delete. But my code assumes that "myFile.txt" travel with vbs file.