When I call following command from the command line, everything works well. But when I put it in a .bat file and call that file, I get the syntax error saying that I'm missing a closing ' at the end of the command.
powershell -command "& 'C:\Program Files\TortoiseSVN\bin\svn.exe' status | ? { $_ -Match '^!\s+(.*)' } | % { & 'C:\Program Files\TortoiseSVN\bin\svn.exe' rm $Matches[1] }"
A strange thing that happens when I call it from .bat is that command gets mysteriously changed. This is the output of the .bat file:
C:\workspace>powershell -command "& 'C:\Program Files\TortoiseSVN\bin\svn.exe' status | ? { $
_ -Match '^!\s+(.*)' } | \Program Files\TortoiseSVN\bin\svn.exe' rm $Matches[1] }"
The string is missing the terminator: '.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : TerminatorExpectedAtEndOfString
I'm 100% sure that the content of the .bat file and the command I run manually are the same and that editor (Notepad++) does not perform a stupid thing like breaking the command in two lines.
What am I doing wrong?
} | \Program Files\Tin that section you are missing a single quote. Should be} | '\Program Files\Tor} | 'C:\Program Files\T. The code, in your examples, differs because of that.