I want to set up a scheduled task and need to ideally fit the following in one line. I have tried using a script block {}
but does not seem to work.
I want to try and put
[String] $cmd = Get-Content \pathto\script.ps1
Invoke-Expression $cmd
$othercmd = abc xyz
Invoke-Expression $othercmd
How would I go about joining them in a one liner so I coud call powershell...
?
I know I could put it in a script and call that from schtasks but I am interested to see if there is a way to join the commands.