I need to run the following batch file:
cd ..
msbuild reve_host.vcxproj
In order for msbuild to work, it needs to be run through a specific shell. Its path is stored in $executorPath in my Powershell script, which looks like this:
$executorPath = 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2019\Visual Studio Tools\VC\x64 Native Tools Command Prompt for VS 2019'
Write-Host "STAGE: CLEAN."
Here are several ways of executing that I have tried, that have not worked:
Invoke-Command '$executorPath "BUILD.bat"'
Invoke-Command '$executorPath ".\BUILD.bat"'
Invoke-Command -ScriptBlock {& $executorPath 'BUILD.bat'}
Invoke-Command -ScriptBlock {& $executorPath '.\BUILD.bat'}
$($executorPath 'BUILD.bat')
$($executorPath '.\BUILD.bat')
With 1 and 2, I get:
Parameter set cannot be resolved using the specified named parameters. One or more parameters issued cannot be used together or an insufficient number of parameters were provided.
With 3 and 4, I get:
The term 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2019\Visual Studio Tools\VC\x64 Native Tools Command Prompt for VS 2019' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
None of these work. How do I run this?