Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automating cygwin commands in windows command line (and ultimately in MsBuild)

I have a situation where I have a few cygwin commands which I wish to be run in Windows command line e.g.

chmod 777 /home/administrator/*

Currently I have to manually type in cygwin.bat, then enter the above command in cygwin. I was wondering whether it is possible (and if so, how) to have these steps automated in Windows command line?

Ultimately I want all of the above commands to be in MsBuild to achieve full automation if possible.

Thanks.

like image 423
BeraCim Avatar asked Jan 13 '10 01:01

BeraCim


People also ask

What is Cygwin and how do you use it?

Cygwin is a collection of open source tools that allows Unix or Linux applications to be compiled and run on a Microsoft Windows operating system (OS) from within a Linux-like interface. Cygwin offers users a Linux-like experience in a Windows environment.


1 Answers

One way to do this is to launch windows command prompt from a batch file, then, in there, call the shell script which has the command that you want to run.

batchfile-for-cygwin.bat will contain

@echo off
C:\cygwin\bin\bash -li /cygdrive/c/<path-to-shell-script-location>/chmod-cmd.sh

And then, in chmod-cmd.sh you can just have the command.

chmod 777 /home/administrator/*

With this kind of setup, you can use it in MSBuild too, I should think. I use it in Ant scripts and it works for me.

like image 61
omermuhammed Avatar answered Oct 08 '22 01:10

omermuhammed