You can run cmd.exe
or PowerShell commands by sticking them in .bat
or .ps1
scripts and calling those from the Travis script
, as long as you don’t mind the scripts running as a single job step.
For cmd.exe
stuff: Put your commands in a .bat script file and call the .bat file as a command from the main script. Git bash is smart enough to run that under cmd.exe
.
script:
- my_cmd_script.bat
For PowerShell, you need to enable script execution, and then you can call .ps
scripts with PowerShell -File <file>
.
install:
- PowerShell -Command 'Set-ExecutionPolicy -ExecutionPolicy RemoteSigned'
script:
- PowerShell -File my_powershell_script.ps1
You can also run single PowerShell commands using PowerShell -Command <command>
from the script. You will probably need to put <command>
in single quotes to get bash escaping right.
I think calling powershell
without any arguments will fire up an interactive PowerShell session, which is why your build hangs.
Example: https://travis-ci.com/apjanke/travis-octave-windows/builds/98765078
I’d suggest writing your scripts in PowerShell instead of .bat files, even if you’re not familiar with it, because .bat is the worst scripting language ever invented.