How do I install cURL on cygwin?

I just encountered this. 1) Find the cygwin setup.exe file from http://cygwin.com/ and run it. 2) Click/enter preferences until you reach the “Select Packages” window. (See image) 3) Click (+) for Net 4) Click the entry for curl. (Make sure you select the checkbox for the Binary) 5) Install. 6) Open a cygwin window and … Read more

Root user/sudo equivalent in Cygwin?

I answered this question on SuperUser but only after the OP disregarded the unhelpful answer that was at the time the only answer to the question. Here is the proper way to elevate permissions in Cygwin, copied from my own answer on SuperUser: I found the answer on the Cygwin mailing list. To run command … Read more

Winapi: Get the process which has specific handle of a file

For this task, starting with Windows Vista special exist FileProcessIdsUsingFileInformation FILE_INFORMATION_CLASS. So we need open file with FILE_READ_ATTRIBUTES (this is possible even if somebody open file with 0 share mode. of if we have no access to file (by it DACL) but have read access to parent directory). and call NtQueryInformationFile with FileProcessIdsUsingFileInformation. on return … Read more

How do I use awk under cygwin to print fields from an excel spreadsheet?

The combination of the following VBS and shell scripts create a CSV file for each sheet in the Excel spreadsheet: $ cat xls2csv.vbs csv_format = 6 Dim strFilename Dim objFSO Set objFSO = CreateObject(“scripting.filesystemobject”) strFilename = objFSO.GetAbsolutePathName(WScript.Arguments(0)) If objFSO.fileexists(strFilename) Then Call Writefile(strFilename) Else wscript.echo “no such file!” End If Set objFSO = Nothing Sub Writefile(ByVal … Read more

Using Windows Python from Cygwin

The real problem is that when you run a command in any of the Cygwin terminal programs like mintty, they don’t act as Windows Consoles. Only Windows Console-based ones like CMD or Console2 do that. So, with Cygwin terminals the Windows python.exe doesn’t think it is talking to an interactive console. That leads to buffering … Read more

How can I install MinGW-w64 and MSYS2?

Unfortunately, the MinGW-w64 installer you used sometimes has this issue. I myself am not sure about why this happens (I think it has something to do with Sourceforge URL redirection or whatever that the installer currently can’t handle properly enough). Anyways, if you’re already planning on using MSYS2, there’s no need for that installer. Download … Read more

How to cd into a directory with space in the name?

$ cd “$DOCS” You need to quote “$DOCS” to prevent spaces from being parsed as word separators. More often than not, variable references should be quoted. Note that $HOME would have the same problem. The issue is coming from when the shell evaluates variable references; it’s nothing to do with what variables you use or … Read more