cygwin

如何从Windows命令行获取应用程序退出代码?

丶灬走出姿态 提交于 2019-12-20 19:13:29
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 我正在运行一个程序,想查看它的返回代码是什么(因为它会根据不同的错误返回不同的代码)。 我知道在Bash中,我可以通过运行 回声$? 在Windows上使用cmd.exe怎么办? #1楼 测试 ErrorLevel 适用于 控制台 应用程序,但是 dmihailescu 暗示,如果您试图从命令提示符下运行 窗口化 应用程序(例如基于Win32的 窗口) ,则此方法将无效。 一个窗口化的应用程序将在后台运行,并且控件将立即返回到命令提示符(最有可能的 ErrorLevel 为零,以指示该进程已成功 创建 )。 当窗口应用程序最终退出时,其退出状态将丢失。 但是,与其使用其他地方提到的基于控制台的C ++启动器,一种更简单的选择是使用命令提示符下的 START /WAIT 命令来启动窗口应用程序。 这将启动带窗口的应用程序,等待其退出,然后将控制权返回到命令提示符,并在 ErrorLevel 中设置进程的退出状态。 start /wait something.exe echo %errorlevel% #2楼 如果要完全匹配错误代码(例如等于0),请使用以下代码: @echo off my_nify_exe.exe if %ERRORLEVEL% EQU 0 ( echo Success ) else ( echo

error C3861: 'strcasecmp': identifier not found in visual studio 2008?

前提是你 提交于 2019-12-20 18:33:37
问题 im trying to port application from cygwin to visual studio 2008 express but im getting this error : error C3861: 'strcasecmp': identifier not found in this type of code: if (!strcasecmp("A0", s)) .... what is the replacement in vs? i can't find any thing in the net 回答1: add this to your precompiled header (or some other config.h) #ifdef _MSC_VER //not #if defined(_WIN32) || defined(_WIN64) because we have strncasecmp in mingw #define strncasecmp _strnicmp #define strcasecmp _stricmp #endif

error C3861: 'strcasecmp': identifier not found in visual studio 2008?

﹥>﹥吖頭↗ 提交于 2019-12-20 18:31:30
问题 im trying to port application from cygwin to visual studio 2008 express but im getting this error : error C3861: 'strcasecmp': identifier not found in this type of code: if (!strcasecmp("A0", s)) .... what is the replacement in vs? i can't find any thing in the net 回答1: add this to your precompiled header (or some other config.h) #ifdef _MSC_VER //not #if defined(_WIN32) || defined(_WIN64) because we have strncasecmp in mingw #define strncasecmp _strnicmp #define strcasecmp _stricmp #endif

How to compile existing posix code for 64-bit Windows?

耗尽温柔 提交于 2019-12-20 15:46:28
问题 I'm ok with using Cygwin or MinGW, but I need to end up with 64-bit code, not 32-bit. This is because I will be calling the DLL from 64-bit managed C#. I can't seem to find and good references for setting up those tools to create 64-bit binaries. Also, it would be nice if the GCC was version 4, not version 3 as came with my Cygwin install. An alternative would be some form of interprocess communication. I will research that, but what I laid out above is what I really want. 回答1: The 64-bit

How to compile existing posix code for 64-bit Windows?

大城市里の小女人 提交于 2019-12-20 15:46:00
问题 I'm ok with using Cygwin or MinGW, but I need to end up with 64-bit code, not 32-bit. This is because I will be calling the DLL from 64-bit managed C#. I can't seem to find and good references for setting up those tools to create 64-bit binaries. Also, it would be nice if the GCC was version 4, not version 3 as came with my Cygwin install. An alternative would be some form of interprocess communication. I will research that, but what I laid out above is what I really want. 回答1: The 64-bit

Cygwin - How to install ansible?

佐手、 提交于 2019-12-20 10:41:59
问题 How to get / install ansible using Cygwin? I tried the following steps but it's didn't work during bullet 5 (while running " python setup.py install "). Steps taken from: Taken from https://servercheck.in/blog/running-ansible-within-windows 1) Download and install Cygwin, with at least the following packages selected (you can select the packages during the install process): libyaml libyaml-devel curl python (2.7.x) python-crypto python-openssl python-paramiko python-setuptools git (2.1.x) vim

How do I execute a file in Cygwin?

故事扮演 提交于 2019-12-20 10:16:09
问题 How can I execute a.exe using the Cygwin shell? I created a C file in Eclipse on Windows and then used Cygwin to navigate to the directory. I called gcc on the C source file and a.exe was produced. I would like to run a.exe . 回答1: ./a.exe at the prompt 回答2: you should just be able to call it by typing in the file name. You may have to call ./a.exe as the current directory is usually not on the path for security reasons. 回答3: just type ./a in the shell 回答4: To execute a file in the current

“Permission Denied” using cygwin in Windows

筅森魡賤 提交于 2019-12-20 09:56:05
问题 Background: I am trying to write a [.bat] file so I can double click it and a bash script will get invoked. The bash script will start up a few windows GUI apps to monitor GPU/CPU temperatures. I just did a fresh install of cygwin v1.7.7-1 (downloaded today) and windows 7. Code: monitor-temps.bat: C:\cygwin\bin\bash.exe ~/bin/monitor-temps.bash pause Code: monitor-temps.bash: #!/usr/bin/bash "/cygdrive/c/Users/michael/Desktop/apps_and_drivers/GPU-Z.0.4.8.exe" & Output: After I double click

Cygwin git fork() error on pull

痴心易碎 提交于 2019-12-20 09:24:21
问题 The basic problem is that sometimes when I do git pull upstream master I get remote: Counting objects: 172, done. remote: Compressing objects: 100% (57/57), done. remote: Total 119 (delta 45), reused 95 (delta 21) 0 [main] git 8660 fork: child -1 - forked process 4520 died unexpectedly, retry 0, exit code -1073741515, errno 11 error: cannot fork() for index-pack: Resource temporarily unavailable fatal: fetch-pack: unable to fork off index-pack The exit code is the same every time, the number

How would I find the cygwin version which has been installed on my machine

不问归期 提交于 2019-12-20 08:47:03
问题 Cygwin - How would I find the Cygwin's version which has been installed on my machine? (Win Vista) 回答1: With the uname utility, as on other POSIX systems. uname -r 回答2: If you want to detect if you're running the 32 bit or 64 bit version, the -m switch will tell you: uname -m "i686" for the 32-bit version, "x86_64" if it's 64-bit. uname -a ..gives you all the information at once. Check man uname for details. (This is also answered in How do I tell whether my cygwin installation is 32 or 64