Jump to content

Something I've been meaning to ask...

Recommended Posts

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.

Link to post
Share on other sites

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"')
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...