Home > OS >  Start Powershell process with multiple line script as an argument
Start Powershell process with multiple line script as an argument

Time:01-31

I'm trying to start powershell process with this command:

$command = @"
select volume = D
delete partition override
"@
$command | diskpart

When I paste it into Powershell it works but it doesn't when I'm trying to use it as an argument when starting Powershell process. How do I format the command for it to work? I tried using ' but It didn't help.

CodePudding user response:

Using -EncodedCommand and converting to base64 worked.

  • Related