Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder4.news.weretis.net!feeder.news-service.com!94.75.214.39.MISMATCH!aioe.org!.POSTED!not-for-mail From: Deanna Earley Newsgroups: microsoft.public.vb.general.discussion,comp.lang.basic.visual.misc Subject: Re: Splitting a string containg filename+path and arguemnts Date: Wed, 15 Jun 2011 15:21:34 +0100 Organization: Aioe.org NNTP Server Lines: 26 Message-ID: References: NNTP-Posting-Host: rjApkXnSOjrT83QpZ8fKqg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 X-Notice: Filtered by postfilter v. 0.8.2 Xref: x330-a1.tempe.blueboxinc.net comp.lang.basic.visual.misc:266 On 15/06/2011 13:59, Leo wrote: > I am writing a Shell() replacement that I intend to be a drop in > replacement. I am using ShellExecuteEx so I can parse a n image or text > file in. The problem comes with spliting the arguements from the > path+filename, what is the best way to split them assuming possible > paths with spaces that aren't quoted. An example that works with Shell() > and WinExec (I know I shouldn't be using it) but I strugle with spliting > is C:\Program Files\Windows NT\Accessories\wordpad.exe > C:\Users\username\Documents\somertf.rtf . PathRemoveArgs gets confused > and cuts the path at the space in "Program Files". The "official" way is to split on the first unquoted space. You can try to be more intelligent by splitting on eahc in turn until you get a match for a valid file. Alterntaively, just pass the whole lot to ShellExecute as lpFile and let it handle it. It's a lot more forgiving... -- Dee Earley (dee.earley@icode.co.uk) i-Catcher Development Team http://www.icode.co.uk/icatcher/ iCode Systems (Replies direct to my email address will be ignored. Please reply to the group.)