Jenkins Execute Windows batch command fails for file change


#1

Hi all,
I am new Jenkins, I am trying to change text in a config file using Jenkins Windows batch command but its giving the following error.

(Get-Content config_qa.properties )  | {$_ -replace "test123", "test"}   | Set-Content config_qa.properties 

Ran the above in jenkins windows batch command. below is the error message.

'{$_' is not recognized as an internal or external command,
operable program or batch file.
Build step 'Execute Windows batch command' marked build as failure
[workspace] $ cmd /c call C:\windows\TEMP\hudson2235664364282200461.bat

Thanks.


#2

Did not compute…


#3

I think you’re looking for stack overflow bro.


#4

Execute Windows batch command from jenkins to follow this article :- Jenkins installation on windows look example for more details.


#5