Jump to content

Opening an .ini File


Recommended Posts

  • Moderators

ShellExecute()

This would be my preferred method... but you can also use Run() as you stated above litlmike.

$sFile = "C:\TEST.INI"
Run(@Comspec & ' /c "' & $sFile & '"', "", @SW_HIDE)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Thanks to the both of you.

@Smoke

Hmmm, not sure why Run did not work when I tried it. I just tried it again, and it still don't work.

Wiki:

ComSpec (or %COMSPEC%) is one of the environment variables used in MS-DOS and Microsoft Windows, which normally points to the command line interpreter, which is by default command.com or cmd.exe. The ComSpec environment variable by default points to the full path of the command line interpreter. ComSpec is the secondary command line interpreter, which can be anywhere on your system and does not need to be named COMMAND.COM.

Still don't know why ComSpec is preferred. Does it have something to do with the File Path?

Link to comment
Share on other sites

  • Moderators

Run can work... just needs the "start" statement

$sFile = "C:\TEST.INI"

If FileExists( $sFile) then
    Run(@ComSpec & " /c Start " & $sFile, "", @SW_HIDE)
Else
    MsgBox(0x0,"error", "file not found   ", 3)
EndIf

8)

Hmm, I didn't need the start statement on XP Pro SP2... but I'm sure that is correct all the same.

@Tas, yes ... since ShellExecute was added, that has been my preferred method for calling such things like this and or launching website addresses.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Hmm, I didn't need the start statement on XP Pro SP2... but I'm sure that is correct all the same.

@Tas, yes ... since ShellExecute was added, that has been my preferred method for calling such things like this and or launching website addresses.

Agreed! Since I found out about it, I'm so happy with it :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...