Windows neophyte here.
I have a script to move video files from my Downloads folder to my Plex server. The script works fine.
I scheduled it to run every 30 minutes using Schtasks. This works fine but shows a window every time it starts.
schtasks.exe /CREATE /SC DAILY /MO 1 /TN 'MoveMKV' /TR 'powershell.exe C:\Users\rammjet\myApps\movemkv.ps1 -WindowStyle Hidden' /ST 07:00 /RI 30 /DU 24:00
I found an answer on Stack Overflow saying to use Start-Process to start the script with the hidden window flag. However, when I try to schedule that with Schtasks, the script does not trigger.
I tried the following two commands:
schtasks.exe /CREATE /SC DAILY /MO 1 /TN 'MoveMKV' /TR 'start-process powershell.exe -arg C:\Users\rammjet\myApps\movemkv.ps1 -WindowStyle Hidden' /ST 07:00 /RI 30 /DU 24:00
schtasks.exe /CREATE /SC DAILY /MO 1 /TN 'MoveMKV' /TR 'start-process -FilePath Powershell.exe -Args C:\Users\rammjet\myApps\movemkv.ps1 -WindowStyle Hidden' /ST 07:00 /RI 30 /DU 24:00
How can I periodically run the script without a window?