grub4dos icon indicating copy to clipboard operation
grub4dos copied to clipboard

command line parameter value with = signs

Open steve6375 opened this issue 8 years ago • 6 comments

I came across this issue when I had a filename of /WinntSetup/enabled=1 present. I was using a batch file to enumerate all files in the folder using ls | call :copyfiles the file enabled=1 is treated as two parameters enabled and 1

Example:

test.bat

!BAT
echo %1 %2 %3 %4

Then enter command:

/test.bat aaa enabled=1 bbb

output:

aaa enabled 1 bbb

Is there any way to fix this?

steve6375 avatar Jan 17 '17 09:01 steve6375

Maybe set an internal parameter so only spaces and tabs are recognised as parameter separators? Or a new grub4dos command, parsecmd=0 for default behaviour and parsecmd=1 for space\tab only?

steve6375 avatar Jan 18 '17 10:01 steve6375

/test.bat aaa “enabled=1” bbb

jianliulin avatar Apr 10 '17 04:04 jianliulin

Thanks, but I am using ls | call :copyfiles

so there are no quotes around each 'value' because ls does not use quotes in the output.

steve6375 avatar Apr 10 '17 08:04 steve6375

ls | set aa= call :copyfiles "%aa%"

jianliulin avatar Apr 19 '17 09:04 jianliulin

ls | set aa= call :copyfiles "%aa%"

That does not work as the list is "aaa bbb cccc=1 dddd" so the whole list is passed as one value. The subroutine uses %1 %2 etc. to get each pathname, so if I remove the " " then it still gets cccc and 1 as separate variables.

steve6375 avatar Apr 19 '17 09:04 steve6375

If a space is in the filename or path, then it is escaped in ls command output e.g. ccc\ ddd.iso So maybe one solution would be to also escape the = sign in the output of the ls command? e.g. doris\=1.iso

I am not sure if this would affect compatibility??? image

steve6375 avatar Apr 19 '17 10:04 steve6375