Jump to content
Sign in to follow this  
therks

Something I've been meaning to ask...

Recommended Posts

therks

As most of us know, the easiest way to launch a file that isn't an exe is to use @ComSpec with the Start command. One thing I've been curious about though, is that if the path I'm trying to run has a space in it, I must enclose it with quotation marks (duh), the problem is, the way my Start acts (WinXP) is that if the first parameter is enclosed in quotes, it sets it as the title of the window. So if I want to launch something with spaces in the filename, I actually have to do something like this:

Run(@ComSpec & ' /c start "" "C:\Program Files\File.txt"')

Now, this doesn't bother me much (except it makes a bit of hassle for portability, 98's doesn't respond the same as XP, and I don't even know about ME or 2K), but I finally decided I had to ask why I haven't seen anybody else having to make up for this "bug" (or is it feature? heh) of the Start command. Am I the only one afflicted with this problem? Or am I just unobservant?

Sorry if this doesn't belong here, I was going to post it in the Chat forum, but I figure it IS AutoIt related.. in a way.

Share this post


Link to post
Share on other sites
MHz

As most of us know, the easiest way to launch a file that isn't an exe is to use @ComSpec with the Start command.

Run(@ComSpec & ' /c start "" "C:\Program Files\File.txt"')

This is how I would run it.
Run(@ComSpec & ' /c "C:\Program Files\File.txt"')

I use Start for executables etc. Not for documents. Comspec will search the registry for the program, to suit the extension. If you have an executable or application, then the purpose of using Start is so you can use it's switches like Start /Wait. If you wanted to use Start in your command above. You would have to call a application like Notepad. Example:

Run(@ComSpec & ' /c start Notepad.exe "C:\Program Files\File.txt"')

Share this post


Link to post
Share on other sites
this-is-me

Look for the shellexecute UDF in these forums. That is the autoit-only method of correctly running a file.


Who else would I be?

Share this post


Link to post
Share on other sites
therks

Heh, funny, I threw 'shellexecute' into the search and only came up with you post at first. Needed to expand my searching field. :idiot:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.