how to run batch file w taskscheduler in the background without stealing focus?


m18xr2

Member
Local time
1:56 PM
Posts
2
OS
win11 and 10
so I have this batch file below to turn off wifi and turn it back on, then using task scheduler to run it every 12 hours

start /B "" "C:\Users\(username)\Tools\WifiSchedule\WLANOFF.lnk"
ping 127.0.0.1 -n 4 > nul
start /B "" "C:\Users\(username)\Tools\WifiSchedule\WLANON.lnk"

the thign is, each time this runs a windows pops up and steal focus and it's quite annoying. blocks what im reading or if im doing work it interrupts and steals focus again when CMD disappearing. what line do I add in the CMD command line to have this in the background?
 

My Computer

System One

  • OS
    win11 and 10
    Computer type
    Laptop
    Manufacturer/Model
    dell/alienware
    CPU
    3940xm
    Memory
    16gb
    Graphics Card(s)
    780m
    Monitor(s) Displays
    18.4
    Screen Resolution
    1080p

FreeBooter

Well-known member
Power User
VIP
Local time
11:56 PM
Posts
1,007
Location
Adana
OS
Windows 11
With this Virtual Basic script (.vbs), you can execute batch script silently.

Change "C:\Registry_Backups\Scripts\RegBackup.bat" with folder path and batch script name.


Code:
Set WshShell = CreateObject("WScript.Shell")

cmds=WshShell.RUN("C:\Registry_Backups\Scripts\RegBackup.bat", 0, True)


Set WshShell = Nothing
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    HP Pavilion
    CPU
    AMD Ryzen 7 5700G
    Motherboard
    Erica6
    Memory
    Micron Technology DDR4-3200 16GB
    Graphics Card(s)
    NVIDIA GeForce RTX 3060
    Sound Card
    Realtek ALC671
    Monitor(s) Displays
    Samsung SyncMaster U28E590
    Screen Resolution
    3840 x 2160
    Hard Drives
    SAMSUNG MZVLQ1T0HALB-000H1
Top Bottom