Issue1567
Created on 2010-03-03.21:44:40 by AndreasEK, last changed 2010-06-01.23:34:15 by otmarhumbel.
msg5558 (view) |
Author: Andreas Ebbert-Karroum (AndreasEK) |
Date: 2010-03-03.21:44:39 |
|
When running jython.bat, this code is expanding a * into a filename, when trying to dequote a parameter:
:getArg
rem remove quotes around first arg
for %%i in (%1) do set _CMP=%%~i
set _ARGS=%2
goto :EOF
The problem is that the for loop looks for filenames which match the pattern given in %1. With a little script from http://ss64.com/nt/syntax-dequote.html I was able to fix that problem:
:getArg
rem remove quotes around first arg
set _CMP=%1
CALL:deQuote _CMP
set _ARGS=%2
goto :EOF
...
:DeQuote
SET _DeQuoteVar=%1
CALL SET _DeQuoteString=%%!_DeQuoteVar!%%
IF [!_DeQuoteString:~0^,1!]==[^"] (
IF [!_DeQuoteString:~-1!]==[^"] (
SET _DeQuoteString=!_DeQuoteString:~1,-1!
) ELSE (GOTO :EOF)
) ELSE (GOTO :EOF)
SET !_DeQuoteVar!=!_DeQuoteString!
SET _DeQuoteVar=
SET _DeQuoteString=
GOTO :EOF
|
msg5623 (view) |
Author: Philip Jenvey (pjenvey) |
Date: 2010-04-04.18:05:19 |
|
This might be a dupe of #1356 but I'm not sure
|
msg5703 (view) |
Author: Pekka Klärck (pekka.klarck) |
Date: 2010-04-14.14:55:34 |
|
I noticed the same problem too, and because I failed to search the tracker first I submitted #1594 about it. I also found an alternative fix for the problem.
See also issue #1599 about more problems with special characters in arguments to jython.bat. Having a native .exe launcher for Windows (#1491) would be awesome.
|
msg5707 (view) |
Author: Andreas Ebbert-Karroum (AndreasEK) |
Date: 2010-04-15.11:28:54 |
|
I cannot judge, if the solution proposed here, or in #1594 by Pekka is more appropriate. Apparently, the argument shall be dequoted. Both solutions appear to do the job, although I ask myself, why such a complicated script :DeQuote exists, when the solution is as simple as using the %~ notation :)
I understood this microsoft document so, that the variable substitution is only available in for loops:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/for.mspx?mfr=true
Maybe on newer windows versions, it's generally available?
|
msg5710 (view) |
Author: Pekka Klärck (pekka.klarck) |
Date: 2010-04-15.13:33:03 |
|
I think the point of :DeQuote is that it handles both single and double quotes. %~1 apparently only removes double quotes but that seems to be exactly what's needed in this case.
|
msg5791 (view) |
Author: Oti Humbel (otmarhumbel) |
Date: 2010-06-01.23:34:15 |
|
fixed with revision 7060
many thanks to Pekka Klaerck and Andreas Ebbert-Karroum for their analysis and suggestions!
|
|
Date |
User |
Action |
Args |
2010-06-01 23:34:15 | otmarhumbel | set | status: open -> closed resolution: fixed messages:
+ msg5791 |
2010-04-18 10:02:35 | otmarhumbel | set | assignee: otmarhumbel |
2010-04-15 13:33:03 | pekka.klarck | set | messages:
+ msg5710 |
2010-04-15 11:28:55 | AndreasEK | set | messages:
+ msg5707 |
2010-04-15 06:38:09 | otmarhumbel | set | nosy:
+ otmarhumbel |
2010-04-14 14:55:34 | pekka.klarck | set | nosy:
+ pekka.klarck messages:
+ msg5703 |
2010-04-04 18:05:20 | pjenvey | set | nosy:
+ pjenvey messages:
+ msg5623 title: Wildcard Parameter * gets expanded to filename -> [Windows] Wildcard Parameter * gets expanded to filename |
2010-03-28 20:46:28 | AndreasEK | set | type: behaviour components:
+ Core, - Any |
2010-03-03 21:44:40 | AndreasEK | create | |
|