Pandemic Posted December 18, 2009 Share Posted December 18, 2009 (edited) Is there any way to use Batch file variables in AutoIt? For instance, %systemroot% or %username%? Currently, I'm getting the username by running a batch file that echoes %username% to a text file, then reading it in, then deleting the file. This is obviously inefficient... is there a way to get the username directly through AutoIt, or use batch variables directly? -Pandemic EDIT: Probably should've explored before I posted, but oh well. Found the "@UserName" variable, so I'm good . Edited December 18, 2009 by Pandemic Link to comment Share on other sites More sharing options...
Developers Jos Posted December 18, 2009 Developers Share Posted December 18, 2009 EDIT: Probably should've explored before I posted, but oh well. Found the "@UserName" variable, so I'm good .Don't be this nice to yourself... Of course you should have done that first! SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Mobius Posted December 18, 2009 Share Posted December 18, 2009 Having AutoIt3 parse command shell compliant evars is not as inefficient as you might expect, If you really need them add this to your script. Opt("ExpandEnvStrings",1); Enable MsgBox(64,@SCRIPTNAME,"Hello %USERNAME% Evars in strings are enabled") Opt("ExpandEnvStrings",0); Disable MsgBox(64,%COMPUTERNAME%,"Hello "& @USERNAME &" Evars in strings are Disabled. (see title)") Basically if a macro exists use the macro instead of the environment variable, but if you want user defined evars, no reason why you can't have them if you prefer. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now