从Cygwin的Get命令的结果批 [英] Get results of command from Cygwin in Batch

查看:154
本文介绍了从Cygwin的Get命令的结果批的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有点新Cygwin和我试图运行批处理在Cygwin中一个shell脚本,并获得返回值。我一直在寻找四周,我尝试使用 C:\\ cygwin的[64] \\ BIN \\庆典[64] .exe文件,甚至搞乱C:\\ Cygwin的[64] \\ Cygwin.bat ,但无济于事。

I'm a little new to Cygwin and I'm trying to run a shell script in Cygwin from Batch and get the return value. I've been searching around, and I tried using C:\cygwin[64]\bin\bash[64].exe and even messing with C:\cygwin[64]\Cygwin.bat but to no avail.

基本上,我只是希望能够从批,使用bash(从Cygwin的)进行交互。请原谅我,如果这似乎微不足道给你,因为我是相当新的Cygwin的。不管怎么说,我还没有找到工作的在线解决方案。

Basically, I just want to be able to, from batch, interact with bash (from Cygwin). Please excuse me if this seems trivial to you, as I am rather new to Cygwin. Anyways, I have yet to find a working online solution.

cygwin-magic "echo shell-command"
#=> shell-command

一些东西,我试过

我发现所有这些事情从一个漫长的谷歌追捕。没有什么做了什么,我把它想。

Some Stuff I've Tried

I found all of these things from a lengthy Google hunt. Nothing did what I wanted it to.

"C:\cygwin[64]\bin\base[64].exe" /cygdrive/c/users/<me>/desktop/tmp.sh
#=> ZWNobyAiaGVsbG8i

"C:\cygwin[64]\bin\base[64].exe" -d /cygdrive/c/users/<me>/desktop/tmp.sh
#=> y▒h/usr/bin/base[64]: invalid input

"C:\cygwin[64]\bin\base[64].exe" -d -i /cygdrive/c/users/<me>/desktop/tmp.sh
#=> y▒h▒▒e/usr/bin/base[64]: invalid input

"C:\cygwin[64]\bin\base[64].exe" -d -i "echo hello"
#=> /usr/bin/base[64]: echo hello: No such file or directory

# I kind of gave up on all of my other attempts and tried this because why not? Surprise surprise, it didn't work (not that I expected it to).
"C:\cygwin[64]\Cygwin.bat"
echo "hello"

tmp.sh

内容

简单地说,

echo "hello"

目的

我想从一批这样做的原因是,我想从另一种语言,通过批处理(在Windows上)使用bash进行交互。我有我的解决方案,在第三语言策划出来的,但它只是批到cygwin的那个不工作。

Purpose

The reason I want to do this from batch is that I want to interact with bash from another language through batch (on Windows). I've got my solution planned out in that third language, but it's just the batch-to-cygwin that's not working.


  • Windows 7家庭premium 64

  • Cygwin的的x64

  • 我写的所有 64 ■在code作为 [64] ,因为我知道32位建立不使用。

  • 如果我错过了什么,或我的问题是有点过(太广,太具体,等),请评论,我会改变它。

  • Windows 7 Home Premium x64
  • Cygwin x64
  • I wrote all 64s in the code as [64] because I know 32-bit builds don't use that.
  • If I missed something or my question's a little off (too broad, too specific, etc.), please comment and I'll change it.

推荐答案

也许你的意思是C:\\ cygwin的[64] \\ BIN \\猛砸[64] .EXE不是C:\\ cygwin的[64] \\ BIN \\基地[64] .EXE

这篇关于从Cygwin的Get命令的结果批的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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