0

I have Cygwin installed in order to use Linux command line tools on Windows. I also added it to my PATH. In general, it works fine, but I observe this weird behavior:

I want to run sha256sum on the file C:\Users\s1504gl\Desktop\Täst .txt. Note the german Umlaut ä and the whitespace before the file extension. In order to avoid problems with paths, I always quote paths in command line calls, such as:

sha256sum "C:\Users\s1504gl\Desktop\Täst .txt"

However, PowerShell returns

/usr/bin/sha256sum: '"C:\Users\s1504gl\Desktop\T'$'\303\244''st .txt"': No such file or directory

When I rename the file to either Täst.txt or Test .txt, it works. So the combination of the special character ä and the whitespace seems to cause the problem. Exchanging double quotes by single quotes does not change anything in this case.

I am pretty sure it has to to with PowerShell since the example works without any problems on my Linux machine.

Is there some other way of escaping special characters and/or blanks that I do not know?

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
der_grund
  • 1,898
  • 20
  • 36

2 Answers2

0

Run from Cygwin terminal

sha256sum "/cygdrive/C/Users/s1504gl/Desktop/Täst\ .txt"

In general Cygwin program do not accept Windows paths and works surely with POSIX path

matzeri
  • 8,062
  • 2
  • 15
  • 16
  • This returns `sha256sum: '/cygdrive/C/Users/s1504gl/Desktop/Täst\ .txt': No such file or directory`. Anyway, in the Cygwin Terminal works my code from above. But I need a solution that runs in PowerShell or cmd.exe ... – der_grund Nov 27 '18 at 22:33
0

I found the following workaround:

I create a temporary file from R, containing all the necessary commands and then run this tempfile using bash which is also included in Cygwin. This way, I escape from the problem occurring due to different encodings in Windows and the Linux tools from Cygwin.

der_grund
  • 1,898
  • 20
  • 36