How can i get multiline powershell script to work in yml
i can't get the command to work when loading from appveyor.yml file.
what am i doing wrong?
```
for:
-
matrix:
only:
- configuration: Release
job_name: Tests A
platform: Any CPU # this setting is ignored
test_script:
- ps: >-
$powershell7 = 'C:\Program Files\PowerShell\7\pwsh.exe'
$command = 'C:\projects\appveyor_scripts\TestA.ps1'
& $powershell7 -file $command
-
matrix:
only:
- configuration: Release
job_name: Tests B
platform: Any CPU # this setting is ignored
test_script:
- ps: >-
$powershell7 = 'C:\Program Files\PowerShell\7\pwsh.exe'
$command = 'C:\projects\appveyor_scripts\TestB.ps1'
& $powershell7 -file $command
-
matrix:
only:
- configuration: Release
job_name: Tests C
platform: Any CPU # this setting is ignored
test_script:
- ps: >-
$powershell7 = 'C:\Program Files\PowerShell\7\pwsh.exe'
$command = 'C:\projects\appveyor_scripts\TestC.ps1'
& $powershell7 -file $command
```
I am getting this error.
```
$powershell7 = 'C:\Program Files\PowerShell\7\pwsh.exe' $command = 'C:\projects\appveyor_scripts\TestA.ps1' & $powershell7 -file $command
At line:1 char:57
+ ... wershell7 = 'C:\Program Files\PowerShell\7\pwsh.exe' $command = 'C:\p ...
+ ~~~~~~~~
Unexpected token '$command' in expression or statement.
At line:1 char:109
+ ... sh.exe' $command = 'C:\projects\appveyor_scripts\TestA.ps1' & $powers ...
+ ~
Unexpected token '&' in expression or statement.
```
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
rafae11 closed this discussion on 03 Jun, 2020 08:36 PM.