Help on making this batch run quiet with no window

Discussion in 'Scripting' started by Viggen66, Nov 8, 2013.

  1. Viggen66

    Viggen66 MDL Senior Member

    May 24, 2011
    271
    92
    10
    #1 Viggen66, Nov 8, 2013
    Last edited by a moderator: Apr 20, 2017
    Dear Users,

    I'm writing this code to run whenever the computer boots, as an administrator account with password, it works but I want to run it hidden like no one could ever notice it's working

    Code:
    Option explicit
    Dim oShell
    set oShell= Wscript.CreateObject("WScript.Shell")
    oShell.Run "RunAs /user:administrador ""C:\Drivers\Fix.bat"
    WScript.Sleep 100
    oShell.Sendkeys "xx23~"
    Wscript.Quit
    Could you please help me to hide the window
     
  2. Mr Jinje

    Mr Jinje MDL Expert

    Aug 19, 2009
    1,773
    1,080
    60
    #2 Mr Jinje, Nov 8, 2013
    Last edited by a moderator: Apr 20, 2017
    This is how I do invisible from vbs. You'll need some changes to make it 'run as' administrator, good luck

    Code:
    CreateObject("Wscript.Shell").Run """" & "C:\Drivers\Fix.bat" & """", 0, False
     
  3. SuperBubble

    SuperBubble MDL Member

    Nov 18, 2011
    148
    244
    10
    I would be derelict in my duty if I didn't mention that it's pretty unlikely that Shell.SendKeys will work on an invisible window (that, by definition, doesn't get keyboard focus). o_O

    On the bright side, since you're invoking a batch file, you should be able to edit it to feed your choices directly into it.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Flipp3r

    Flipp3r MDL Expert

    Feb 11, 2009
    1,520
    652
    60
    I know it's off topic but I think your better off renaming the .bat to .cmd as I've had issues in the past running a .bat as admin..
    I've used autoit for for some of my batch files. You can hide the command prompt easily with it...
     
  5. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,527
    4,067
    270
    #5 timesurfer, Nov 9, 2013
    Last edited by a moderator: Apr 20, 2017
    This is the .vbs code to run a batch silent

    Code:
    CreateObject("Wscript.Shell").Run "%systemdrive%\Drivers\Fix.bat",0,True
    This is the task to run your .vbs at logon

    Code:
    schtasks /create /tn "BootTask " /tr "%SystemDrive%\SilentBatch.vbs" /sc onlogon /rl highest /f >nul
    :suicide:...lol

    TS
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...