B
Bryan
i have a batch file that contains these two lines:
-- args.bat
echo %1
echo %2
when i run args.bat from the command line it works correctly... notice that
abc has quotes in the first example and not in the second.
C:\Temp>"c:\program files\test\args" -vv abc
C:\Temp>echo -vv
-vv
C:\Temp>echo abc
abc
C:\Temp>"c:\program files\test\args" -vv "abc"
C:\Temp>echo -vv
-vv
C:\Temp>echo "abc"
"abc"
from python, i'm having trouble getting the quotes around abc to work
.... i, o = os.popen4('"c:/program files/test/args.bat" -vv %s' % arg)
.... print o.read()
....C:\python\python23\lib\site-packages>echo -vv
-vv
C:\python\python23\lib\site-packages>echo abc
abc
'c:/program' is not recognized as an internal or external command,
operable program or batch file.
what is going on here? why does "abc" effect the uoted program name. does
anyone know how to fix this? how to pass a quoted arguments through to
popen? i need to do this because in my real code, i'm passing paths as
arguments and need them quoted.
i'm using python 2.3 on winxp.
thanks,
bryan
-- args.bat
echo %1
echo %2
when i run args.bat from the command line it works correctly... notice that
abc has quotes in the first example and not in the second.
C:\Temp>"c:\program files\test\args" -vv abc
C:\Temp>echo -vv
-vv
C:\Temp>echo abc
abc
C:\Temp>"c:\program files\test\args" -vv "abc"
C:\Temp>echo -vv
-vv
C:\Temp>echo "abc"
"abc"
from python, i'm having trouble getting the quotes around abc to work
.... i, o = os.popen4('"c:/program files/test/args.bat" -vv %s' % arg)
.... print o.read()
....C:\python\python23\lib\site-packages>echo -vv
-vv
C:\python\python23\lib\site-packages>echo abc
abc
'c:/program' is not recognized as an internal or external command,
operable program or batch file.
what is going on here? why does "abc" effect the uoted program name. does
anyone know how to fix this? how to pass a quoted arguments through to
popen? i need to do this because in my real code, i'm passing paths as
arguments and need them quoted.
i'm using python 2.3 on winxp.
thanks,
bryan