Make PowerShell ignore semicolon

powershell

Solution

As an alternative to `Start-Process`, you can just call the command as you would similarly call it using cmd.exe using the call operator `&`:

& msbuild /t:Build;PipelinePreDeployCopyAllFilesToOneFolder /p:Configuration=Debug;_PackageTempDir=$TargetFolder $WebProject

Problem

I want to execute a cmd on PowerShell and this command uses semicolons. Then PowerShell interprets it as multiple commands. How do I make PowerShell ignore the semicolons and execute my command how a unique command? Example: ``` Invoke-Expression "msbuild /t:Build;PipelinePreDeployCopyAllFilesToOneFolder /p:Configuration=Debug;_PackageTempDir=$TargetFolder $WebProject" ``` Another example: ``` Invoke-Expression "test`;test2" ``` And the second example response: ``` The term 'test' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:6 + teste <<<< ;teste2 + CategoryInfo : ObjectNotFound: (teste:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException The term 'test2' is not recognized as the name of a cmdlet, function, script file, or operable program. Chec k the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:13 + teste;teste2 <<<< + CategoryInfo : ObjectNotFound: (teste2:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException ```

Original source