modify script to not display cmd window?

Come up with a useful post-processing script? Share it here!
Post Reply
PiNPOiNT

modify script to not display cmd window?

Post by PiNPOiNT »

Is it possible to have sabnzbd run a script without opening the cmd window?  That steals focus from my game if i am playing at the time.  I checked out this program to see if it would help, but of course, when you run a cmd file to execute this script, it of course opens a cmd window lol.

http://www.ntwind.com/software/utilities/hstart.html

any ideas?
User avatar
switch
Moderator
Moderator
Posts: 1380
Joined: January 17th, 2008, 3:55 pm
Location: UK

Re: modify script to not display cmd window?

Post by switch »

This is untested, but try:

Code: Select all

Const HIDDEN_WINDOW = 12

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("[b]C:\path\to\script.bat[/b]", null, objConfig, intProcessID)
Change the path in the last line, and save the text as a .vbs file in your scripts folder.
Post Reply