I am running a pipeline job on a Windows VM, with default executor as shell. In this job, I wish to run a powershell script, which is located in a directory called CICD, by the following lines:
- powershell .\CICD\build_script.ps1 x86 $PROJECT_PATH
- .\CICD\build_script.ps1 x86 $PROJECT_PATH
- '.\CICD\build_script.ps1 x86 $PROJECT_PATH'
The script has 2 arguments: x86 and $PROJECT_PATH. Everytime I try to run one of these commands, I get this error:
.\CICD\build_script.ps1 : The term '.\CICD\build_script.ps1' 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:1
+ .\CICD\build_script.ps1 x86 C:\GitLab-Runner\builds\BRmNra1o\0\mihnea ...
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (.\CICD\build_script.ps1:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Is there a proper way to run this script?
You need a /
instead of a \
:
- cd CICD
- ./build_script.ps1 x86 $PROJECT_PATH