I got a .patch file which I have to apply onto some source code. Unluckily, I am running on Windows. So I installed the Windows' port of the patch program from http://gnuwin32.sourceforge.net/packages/patch.htm and broght up PowerShell. But I'm not getting done, it always ends up in error. (Aside from the fact that GnuWin32 doesn't install within the "path"...)
First try:
PS D:\eclipsews\fix17435> "C:\Program Files (x86)\GnuWin32\bin\patch.exe" < 17435.patch
Der Operator "<" wird noch nicht unterstützt.
Bei Zeile:1 Zeichen:50
+ "C:\Program Files (x86)\GnuWin32\bin\patch.exe" < <<<< bug-1032189.patch
+ CategoryInfo : ParserError: (<:OperatorToken) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : RedirectionNotSupported
Yes, my Power Shell speaks perfectly German, so googleing the error messages doesn't lead to—probably available—solutions on the net. ☹
Reading here on StackOverflow, I tried to use the "cat" equivalent: "Get-Content", but this ends up in an error, too:
PS D:\eclipsews\fix17435> Get-Content .\17435.patch | "C:\Program Files (x86)\GnuWin32\bin\patch.exe"
Ausdrücke sind nur als erstes Element einer Pipeline zulässig.
Bei Zeile:1 Zeichen:82
+ Get-Content .\bug-1032189.patch | "C:\Program Files (x86)\GnuWin32\bin\patch.exe" <<<<
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpressionsMustBeFirstInPipeline
Btw, calling “Get-Content .\17435.patch” stand-alone works.
Third, I checked the manual of "patch" if it is possible to specify an input file as parameter, to get arround the annoying redirection problem: Yes, using the -i option. But this seems to be blocked, too:
PS D:\eclipsews\fix17435> "C:\Program Files (x86)\GnuWin32\bin\patch.exe" -i 17435.patch
Sie müssen auf der rechten Seite des Operators "-" einen Wertausdruck angeben.
Bei Zeile:1 Zeichen:50
+ "C:\Program Files (x86)\GnuWin32\bin\patch.exe" - <<<< i bug-1032189.patch
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpectedValueExpression
How is stdin redirection on powershell and passing parameters done properly? Is there some documentation anywhere?