在Windows命令行中(并最终在MsBuild中)自动化cygwin命令 [英] Automating cygwin commands in windows command line (and ultimately in MsBuild)

查看:279
本文介绍了在Windows命令行中(并最终在MsBuild中)自动化cygwin命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个情况,我有一些cygwin命令,我希望在Windows命令行中运行

  chmod 777 / home / administrator / * 

目前我必须手动输入cygwin.bat,上面的命令在cygwin。我想知道是否可能(如果是这样,在Windows命令行中使这些步骤自动化)



最终我想要所有上述命令

解决方案

一种方法是从批处理文件启动windows命令提示符,然后在其中调用具有要运行的命令的shell脚本。



batchfile-for-cygwin.bat将包含

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

然后,在chmod-cmd.sh中只需要命令。

  chmod 777 / home /管理员/ * 

使用这种设置,你可以在MSBuild中使用它,我应该想。我在Ant脚本中使用它,它适用于我。


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.

解决方案

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.

这篇关于在Windows命令行中(并最终在MsBuild中)自动化cygwin命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆