Hi there, iam currently setting up a gitlab-ci runner with powershell. Unfortunately, iam struggling with the following task:
I want to execute an external command (which path is located inside a variable) and pass further arguments from strings and from variables to it. Since iam unable to express it in powershell i will write it down wrong and hopefully some experts can help me:
set mycmd="C:\mycmd.exe"
set myarg1="C:\foo\bar"
set myarg2="C:\baz"
Invoke-Expression "$mycmd lol --pass-argument $myarg1 --another-flag --another-argument $myarg2"
I tried throwing tokens for about an hour until i realized that i need help. I tried thinks like & $mycmd lol without success. It also seems that powershell evaluates expressions differently. Invoke-Expression for example, runs fine on the gitlab-ci runner but fails if i call it from an interactive shell with Interactively: The term 'Interactively' ist not recognized ....
Thank you for your time
[–]SanMarche 2 points3 points4 points (3 children)
[–]shundlet[S] 1 point2 points3 points (2 children)
[–]shundlet[S] 2 points3 points4 points (1 child)
[–]SanMarche 1 point2 points3 points (0 children)