windows - Problem with quoted filenames in Batch -


let have batch program:

set foo=c:\temp\%1 bar.exe %foo% 

when call double quoted file name argument these quotes in middle; , fact prevents other programs working correctly:

> fail.bat "aa bb.jpg" set foo=c:\temp\"aa bb.jpg" > bar.exe c:\temp\"aa bb.jpg" cannot find file 

how variable containing correct value "c:\temp\aa bb.jpg"?

you can use %~1 instead, removes quotes parameter.
code should like

set foo="c:\temp\%~1" bar.exe %foo% 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -