Jump to content
Sign in to follow this  
blindwig

IniRead() does not respect ExpandEnvStrings

Recommended Posts

OK, this works:

$Command = 'pause'
RunWait(@Comspec & ' /c ' & $Command)

and this:

AutoItSetOption('ExpandEnvStrings',1)
$Command = '%comspec% /c pause'
RunWait($Command)

but this does not:

AutoItSetOption('ExpandEnvStrings',1)
$Command = IniRead(); let's assume that this returns '%comspec% /c pause'
RunWait($Command)

In fact, the whole process of expanding environment variables seems to be quirky, because this doesn't work:

AutoItSetOption('ExpandEnvStrings',0)
$Command = '%comspec% /c pause'
AutoItSetOption('ExpandEnvStrings',1)
RunWait($Command)

nor does this:

AutoItSetOption('ExpandEnvStrings',0)
$Command1 = '%comspec% /c pause'
AutoItSetOption('ExpandEnvStrings',1)
$Command = $Command1
RunWait($Command)

I wish there was just a function like ExpandEnvStrings() that would return an adjusted string. Maybe I'll go work on that...

Share this post


Link to post
Share on other sites

OK, this works:

$Command = 'pause'
RunWait(@Comspec & ' /c ' & $Command)

and this:

AutoItSetOption('ExpandEnvStrings',1)
$Command = '%comspec% /c pause'
RunWait($Command)

but this does not:

AutoItSetOption('ExpandEnvStrings',1)
$Command = IniRead(); let's assume that this returns '%comspec% /c pause'
RunWait($Command)

In fact, the whole process of expanding environment variables seems to be quirky, because this doesn't work:

AutoItSetOption('ExpandEnvStrings',0)
$Command = '%comspec% /c pause'
AutoItSetOption('ExpandEnvStrings',1)
RunWait($Command)

nor does this:

AutoItSetOption('ExpandEnvStrings',0)
$Command1 = '%comspec% /c pause'
AutoItSetOption('ExpandEnvStrings',1)
$Command = $Command1
RunWait($Command)

I wish there was just a function like ExpandEnvStrings() that would return an adjusted string.  Maybe I'll go work on that...

<{POST_SNAPBACK}>

I tried the bottom 2 on my system with release version and beta, and both worked.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

I tried the bottom 2 on my system with release version and beta, and both worked.

<{POST_SNAPBACK}>

I'm using 3.1.1.0, and all 3 of the bottom ones return something like this:

>"C:\Program Files\AutoIt3\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\UserName\Desktop\New AutoIt v3 Script.au3"

C:\Documents and Settings\UserName\Desktop\New AutoIt v3 Script.au3 (5) : ==> Unable to execute the external program.:

RunWait($Command)

The system cannot find the file specified.

Share this post


Link to post
Share on other sites

Just tried on 3.1.1.44, same results

<{POST_SNAPBACK}>

Oops, nevermind. It does work on 3.1.1.44, but not 3.1.1.0 Edited by blindwig

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...