I want to use the follwing powershell commands to automatically record a stream with vlc:
$rd = get-date -format "yyyyMMdd"
C:\"Program Files"\VideoLan\vlc\vlc.exe https://someurl/playlist.m3u --sout "#file{dst=C:\users\me\desktop\$rd.mp3}" --run-time=15 vlc://quit
That does work well if I save it as a .ps1 script and execute it with "Right Click > Run with PowerShell".
It also works if I paste those commands to the powershell and execute them in one line, like this:
$rd = get-date -format "yyyyMMdd"; C:\"Program Files"\VideoLan\vlc\vlc.exe https://someurl/playlist.m3u --sout "#file{dst=C:\users\me\desktop\$rd.mp3}" --run-time=15 vlc://quit
It even works if I execute this from within the Windows Terminal:
powershell -command {$rd = get-date -format "yyyyMMdd"; C:\"Program Files"\VideoLan\vlc\vlc.exe https://someurl/playlist.m3u --sout "#file{dst=C:\users\me\desktop\$rd.mp3}" --run-time=15 vlc://quit}
So I created a task in the Windows Task Scheduler to automate the execution.
This is the XML of the "Actions" tab:
<Actions Context="Author">
<Exec>
<Command>powershell</Command>
<Arguments>-noexit -command {$rd = get-date -format "yyyyMMdd"; C:\"Program Files"\VideoLan\vlc\vlc.exe https://someurl/playlist.m3u --sout "#file{dst=C:\users\me\desktop\$rd.mp3}" --run-time=15 vlc://quit}</Arguments>
</Exec>
</Actions>
Now, once the task is triggered, the opened PowerShell shows this error:
The string is missing the terminator: ".
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : TerminatorExpectedAtEndOfString
What am I missing?