Avoid batch script from being closed?

Discussion in 'Scripting' started by juanmanuelsanchez, Dec 31, 2019.

  1. juanmanuelsanchez

    juanmanuelsanchez MDL Junior Member

    Aug 21, 2009
    54
    1
    0
    hi all ! I have a script batch file that calls a powershell script on startup (already minimized)

    I need a way to avoid users from closing the script window file. Or if its closed a way to restart it...

    The batch is file cotains:
    Code:
    powershell.exe -window minimized -noexit -file "%USERPROFILE%\Desktop\UNB\script\UNBILLING.ps1" 
    Any help is appreciated.
     
  2. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    16,220
    84,896
    340
    SilentRun.vbs
    Code:
    Set WshShell = CreateObject^("WScript.Shell"^) : WshShell.Run "Full_Path_To_Batch_File.cmd", 0
    then create schedule task to run SilentRun.vbs
     
  3. rpo

    rpo MDL Expert

    Jan 3, 2010
    1,447
    1,424
    60
    A PowerShell variant :

    Code:
    @powershell "Start-Process powershell -window hidden '-file \"%USERPROFILE%\Desktop\UNB\script\UNBILLING.ps1\"'"