opening files at a certain time

Christopher Trexler 21 Reputation points
2021-03-19T18:07:08.923+00:00

I would like to know if there is a Powershell ISE command to schedule a .flac file to open at a specific time (and a cancel command)

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
{count} votes

Accepted answer
  1. Ian Xue (Shanghai Wicresoft Co., Ltd.) 29,971 Reputation points Microsoft Vendor
    2021-03-22T03:53:10.623+00:00

    Hi,

    You can register a scheduled task using the Register-ScheduledTask cmdlet.

    $Time = New-ScheduledTaskTrigger -At 12:00 -Once  
    $User = "Contoso\Administrator"  
    $PS = New-ScheduledTaskAction -Execute "C:\folder\a.flac"  
    Register-ScheduledTask -TaskName "openflac" -Trigger $Time -User $User -Action $PS  
    

    To cancel the task run Unregister-ScheduledTask

    Unregister-ScheduledTask -TaskName "openflac"  
    

    https://learn.microsoft.com/en-us/powershell/module/scheduledtasks/register-scheduledtask
    https://learn.microsoft.com/en-us/powershell/module/scheduledtasks/unregister-scheduledtask

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

3 additional answers

Sort by: Most helpful
  1. Andreas Baumgarten 97,076 Reputation points MVP
    2021-03-19T18:53:18.307+00:00

    hi @Christopher Trexler ,

    maybe this will help:

    Start-Process -Filepath "vlc.exe something.flac"  
      
    Stop-Process -Name "vlc"  
    

    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/start-process?view=powershell-7.1
    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/stop-process?view=powershell-7.1

    Create scripts (start and stop script) and use the Task Scheduler to schedule the scripts.

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    0 comments No comments

  2. Rich Matheisen 45,091 Reputation points
    2021-03-22T14:45:23.977+00:00

    If you can't run scripts you posted in the wrong area! :-)

    You can try this, though: how-create-task-using-task-scheduler-command-prompt


  3. Rich Matheisen 45,091 Reputation points
    2021-03-22T21:25:28.363+00:00

    You can run SCHTASKS from the PowerShell shell as well as from the cmd shell. Start Powershell with "run as administrator".

    Seems like you're trying to subvert the admin's blocking you from doing things. Why not discuss this with that person?