I know this is a strange use case but I need this to execute like this in a new process and be a single line. It has taken me a long time to get to this place. I've been tearing my hair out for hours over this... Please HELP!
This command works in powershell and cmd:
powershell -command "(start-process -PassThru PowerShell -ArgumentList '-file C:\Temp\Test.ps1').Id"
This command works in powershell but not in cmd (can't find the file):
powershell -command "(start-process -PassThru PowerShell -ArgumentList '-file `"C:\Temp\Test.ps1`"').Id"
And when I add a space to the filename it can't find the file in PowerShell or cmd (the file does exist):
powershell -command "(start-process -PassThru PowerShell -ArgumentList '-file `"C:\Temp\Test 1.ps1`"').Id"