How can I force allfile$ command to always use quotes?

I ran into an issue today on some batch files I wrote and have as a commands in my dopus menu. In dopus it's a simple batch call for example:

fs_crc32.btm {allfile$}

For the most part this has worked flawlessly for months. But today I ran into an issue with a file because it has a "," in the file name. So it sees something like file,test1.bin as 2 command line flags %1=file %2=test1.bin. The simple fix would be to just put the filename in quotes, but there doesn't seem to be an option for that in dopus. The fileq modifier for {allfile$|fileq} doesn't work because it throws the filenames it passes to a temporary file. So is there anyway to pass the list of selected files always quoted? The command line length limit is not an issue since I don't use the windows cmd.exe, I use tcc a much better replacement for the windows command line and for the most part I only select a few files at a time.

Also another quirk in dopus. I tried doing:

fs_crc32.btm "{allfile$}"

but it didn't work quite right even for a single selected file because dopus added a leading space to the file name so if I had a file called file,test1.bin it sent " file,test1.bin" which is a problem when you have batch files that does a "if exist %1" test.

You could work around that by feeding things to this VBScript, which then quotes everything and runs whatever it was given as a command.

option explicit Dim Shell Dim Args Dim Command Dim ArgIdx Set Shell = CreateObject("WScript.Shell") Set Args = WScript.Arguments If (Args.Count < 1) Then MsgBox WScript.ScriptName & ": Need some arguments" WScript.Quit 1 End If Command = """" & Args.Item(0) & """" For ArgIdx = 1 To (Args.Count - 1) Command = Command & " """ & Args.Item(ArgIdx) & """" Next Shell.Run Command, 1, TRUE

I saved it as C:\Test Files\quote_all_args.vbs, with a test.bat in the same place, and then made the Opus run this:

"C:\Test Files\quote_all_args.vbs" "C:\Test Files\test.bat" {allfile$}

(Personally, I wouldn't bother with the .bat file at all and would instead do everything in VBScript, but that script gives you a way to work with existing batch files and ensure all arguments are quoted even if they don't contain spaces.)

[quote="LurkerLito"]Also another quirk in dopus. I tried doing:

fs_crc32.btm "{allfile$}"

I wouldn't expect that to do anything useful. A best it would put a single set of quotes around the entire list of files (with extra quotes for files with spaces in their names within the outer quotes), which would never be helpful.

Thanks leo. In hindsight I guess I could have just rewritten the batch files to read the file list from a file and then use the filemq option, but thanks for the script, it'll be useful for other batch files I have.