1. RE: Paths with embedded spaces
- Posted by freeplay at mailandnews.com Aug 16, 2001
- 397 views
Hi Chris, The command_line() function for ex.exe and exw.exe just gives you command line as typed at the command prompt. Nothing more and nothing less. If you have: exw prog.exw file name with spaces.mp3 you get the arguments: file name with spaces.mp3 You might try: exw prog.exw "file name with spaces.mp3" but this gives you: "file name with spaces.mp3" What you really want is a single argument of: file name with spaces.mp3 One way I can think of around this is to write a function, say "quoted_command_line", which might be invoked like this: sequence cmd_line cmd_line = quoted_command_line(command_line()) The function would concatenate all the command line arguments and then split them up again but this time with some special processing for handling the quote (") character. You might want to build a way to have a quote (") character allowed as part of an argument as in: exw prog.exw quote\"character and also with: exw prog.exw "this string has a quote \" in it" The Linux Euphoria doesn't have this problem because the UNIX shell does all this for you before exu has even been called. For example this is perfectly ok in Linux: exu prog.exu "this string has a quote \" in it" So a quoted_command_line type of function is one way to tackle this. If you write one then I for one would appreciate a copy Regards, FP. >===== Original Message From Chris Bensler <bensler at telus.net> ===== > >How do I get around this? >If I try to execute a file using ex/w.exe that contains spaces embedded in >the path, EU thinks that the space is seperating the commandline parameters >from the file name. >It probably has something to do with long filenames, but I haven't a clue >what to do about it. > >Chris > >
2. RE: Paths with embedded spaces
- Posted by freeplay at mailandnews.com Aug 16, 2001
- 405 views
Thanks for that Chris. I tried this on my Windows NT 4.0 system (service pack 6a) here at work and the command quoting works fine. However I'm sure I've had a problem when it hasn't worked though. I think that the quoting facilities provided in a DOS shell might depend on whether you are runing "pure DOS" or whether you are running a "DOS box" from a Windows GUI like Win95, Win98, WinNT or Win2000. Until I get to my test machine at home I'll not be able to prove that. My guess is that pure DOS won't provide quoting but DOS running _within_ Windows does but right now thats just speculation on my part. Here is the program I used to test the quoting with: -- argtest.ex include get.e function main() sequence cmdline cmdline = command_line() for i = 1 to length(cmdline) do printf(1, "Arg %02d is [%s]\n", {i, cmdline[i]}) end for return(wait_key()) end function abort(main()) If anyone wants to try this on a pure DOS machine with: ex argtest.ex "is this one argument" then I'd be interested in the results. Regards, FP. >===== Original Message From Chris Bensler <bensler at telus.net> ===== > >Actually, you CAN quote a filename on DOS/WIN!! >but not the file name and parameters together, which wouldn't make much >sense anyways.. > >but that works for me. >Thanks, yah helped an ya didn't even know it :) >Solves your problem as well > >I did a test.. >ex "test.ex" <-- works >ex test.ex "this should be a sinlge parameter" <-- also works >ex "test.ex" "this is a sinlge parameter" <-- sure thing >ex test.ex "this is a single parameter which contains a \"" <-- no problem >ex "test.ex this should be a sinlge parameter" <-- doesn't, file not found, >which is entirely expected > > >Rob, you might consider documenting that.. that's pretty useful to know. > >Chris > > > >----- Original Message ----- >From: <freeplay at mailandnews.com> >To: "EUforum" <EUforum at topica.com> >Sent: Thursday, August 16, 2001 2:15 AM >Subject: RE: Paths with embedded spaces > > >> >> Hi Chris, >> >> The command_line() function for ex.exe and exw.exe just gives you command >line >> as typed at the command prompt. Nothing more and nothing less. If you >have: >> >> exw prog.exw file name with spaces.mp3 >> >> you get the arguments: >> >> file >> name >> with >> spaces.mp3 >> >> You might try: >> >> exw prog.exw "file name with spaces.mp3" >> >> but this gives you: >> >> "file >> name >> with >> spaces.mp3" >> >> What you really want is a single argument of: >> >> file name with spaces.mp3 >> >> One way I can think of around this is to write a function, say >> "quoted_command_line", which might be invoked like this: >> >> sequence cmd_line >> >> cmd_line = quoted_command_line(command_line()) >> >> The function would concatenate all the command line arguments and then >split >> them up again but this time with some special processing for handling the >> quote (") character. You might want to build a way to have a quote (") >> character allowed as part of an argument as in: >> >> exw prog.exw quote\"character >> >> and also with: >> >> exw prog.exw "this string has a quote \" in it" >> >> The Linux Euphoria doesn't have this problem because the UNIX shell does >all >> this for you before exu has even been called. For example this is >perfectly >> ok in Linux: >> >> exu prog.exu "this string has a quote \" in it" >> >> So a quoted_command_line type of function is one way to tackle this. If >you >> write one then I for one would appreciate a copy >> >> Regards, >> >> FP. >> >> >===== Original Message From Chris Bensler <bensler at telus.net> ===== >> > <snip> >
3. RE: Paths with embedded spaces
- Posted by freeplay at mailandnews.com Aug 22, 2001
- 394 views
Ok I finally got round to testing the quoting options on a "pure DOS" install of MS DOS 6.20 with Euphoria and running my argtest program as follows: ex argtest.ex "is this one argument" Gives me: Arg 01: [C:\EUPHORIA\BIN\EX.EXE] Arg 02: [argtest.ex] Arg 03: [is this one argument] I stand very humbly corrected :-] After a bit more experimenting I have discovered the source of my original confusion. I use the freeware DOS Pacific C Compiler to code up a few utilities here and there and it is this compiler that does _not_ do useful quote (") processing of the command line. Hence it is Euphoria which _does_ do the intelligent work when it discovers quote characters on the command line and groups arguments accordingly. Regards, FP. ---- Original message ---- Thanks for that Chris. I tried this on my Windows NT 4.0 system (service pack 6a) here at work and the command quoting works fine. However I'm sure I've had a problem when it hasn't worked though. I think that the quoting facilities provided in a DOS shell might depend on whether you are runing "pure DOS" or whether you are running a "DOS box" from a Windows GUI like Win95, Win98, WinNT or Win2000. Until I get to my test machine at home I'll not be able to prove that. My guess is that pure DOS won't provide quoting but DOS running _within_ Windows does but right now thats just speculation on my part. Here is the program I used to test the quoting with: -- argtest.ex include get.e function main() sequence cmdline cmdline = command_line() for i = 1 to length(cmdline) do printf(1, "Arg %02d is [%s]\n", {i, cmdline[i]}) end for return(wait_key()) end function abort(main()) If anyone wants to try this on a pure DOS machine with: ex argtest.ex "is this one argument" then I'd be interested in the results. Regards, FP.