How to execute batch file on Windows in Cygwin shell

I am trying to execute a BATCH file via jsp on a windows machine and it works fine without any problems.

However, DOS does not have the equivalent of sed unix command. So I had to install cygwin so that I could use the following sed command in my batch file.

sed -i "s/<model.version>2.1.1-SNAPSHOT<\/model.version>/<model.version>2.1.1-b-1<\/model.version>/g" pom.xml  

My question is how can I call the cygwin shell so that my .bat file is executed in the cygwin command shell and not on the Windows command line.

Below is a snippet of code that works great. The only problem is that it calls the command line. I want to call the cygwin shell instead of the command line.

File dir = new File("C:\\Projects\\release-builds");  
Runtime.getRuntime().exec("cmd.exe /c start build-model.bat", null, dir);  

Please inform.

+3
source share
2

cygwin PATH. ( PATH ), cygwin DOS bat script.

c:\cygwin\usr\bin\sed.exe .

+2

sed gnuwin ? Windows.

+2

Source: https://habr.com/ru/post/1780692/


All Articles