[SOLVED]Switches and parameters for creating tasks

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
serverdelux
Posts: 36
Joined: 04 Oct 2013 14:14

Re: [NOT SOLVABLE] Switches and parameters for creating task

#16 Post by serverdelux » 27 Oct 2013 23:20

carlsomo wrote:Try running hide.vbs with the batch file as parameter
Hide.vbs:

Code: Select all

Const HIDDEN_WINDOW = 12

if WScript.Arguments.Count = 0 then
    WScript.Echo "Missing parameters"
end if

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")

Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = HIDDEN_WINDOW
Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")
errReturn = objProcess.Create("Wscript.Arguments(0)", null, objConfig, intProcessID


Hi, can you explain what this is suppose to and how I am going to run the .bat with a silent task and this .vbs simultaneously

Thank you

serverdelux
Posts: 36
Joined: 04 Oct 2013 14:14

Re: [NOT SOLVABLE] Switches and parameters for creating task

#17 Post by serverdelux » 28 Oct 2013 12:29

Followed your instructions:

Created two tasks like this:

Code: Select all

schtasks /create /tn "Task1" /tr "%SystemDrive%\1\2\1.bat" /sc onlogon /rl highest /f

Code: Select all

schtasks /create /tn "Task2" /tr "%SystemDrive%\1\2\1.vbs" /sc onlogon /rl highest /f


These both say their running but neither 1.bat nor 1.vbs ran nor did 1.bat call 2.bat

Still unsolvable :P...lol

Thanks

carlsomo
Posts: 91
Joined: 02 Oct 2012 17:21

Re: [NOT SOLVABLE] Switches and parameters for creating task

#18 Post by carlsomo » 28 Oct 2013 20:07

If 1.vbs contains the hide.bat code in same folder as 1.bat:

schtasks /create /tn "Task2" /tr "%SystemDrive%\1\2\1.vbs %SystemDrive%\1\2\1.bat" /sc onlogon /rl highest /f

serverdelux
Posts: 36
Joined: 04 Oct 2013 14:14

Re: [NOT SOLVABLE] Switches and parameters for creating task

#19 Post by serverdelux » 29 Oct 2013 00:36

    carlsomo wrote:If 1.vbs contains the hide.bat code in same folder as 1.bat:

    schtasks /create /tn "Task2" /tr "%SystemDrive%\1\2\1.vbs %SystemDrive%\1\2\1.bat" /sc onlogon /rl highest /f


    I think I'll get the same results as I did two tasks that ran both so this is kinda the same :?

    Meanwhile can you write a task to run a batch minimized, been trying with no luck :(

    I was only able to write a task to run a bat that used the start/ min cmd to have another bat be minimized

    Thanks

    serverdelux
    Posts: 36
    Joined: 04 Oct 2013 14:14

    Re: [SOLVED]Switches and parameters for creating tasks

    #20 Post by serverdelux » 31 Oct 2013 21:25

    [SOLVED]

    This is .vbs that runs .bat silently

    Code: Select all

    CreateObject("Wscript.Shell").Run "%SystemDrive%\Folder\?.bat",0,True

    Post Reply