Jump to content
Sign in to follow this  
Erlend

RunASWait With variable from ini file

Recommended Posts

Erlend

Hello

I am trying to use RunASWait with iniread:

Dim $app
$app = IniRead("s:\vismakiller\config.ini", "SERVERS", "app", "NotFound")
MsgBox(4096, "App er:", $app)
If Not IsAdmin() Then
RunAsWait('user_', "domain_", 'password_', 0, $app , @SW_MAXIMIZE)
EndIf

Whan do i have to do to get the variable to work inn the RunAsWait command?

Edited by Erlend

Share this post


Link to post
Share on other sites
azure

Hello

I am trying to use RunASWait with iniread:

Dim $app
$app = IniRead("s:\vismakiller\config.ini", "SERVERS", "app", "NotFound")
MsgBox(4096, "App er:", $app)
If Not IsAdmin() Then
RunAsWait('user_', "domain_", 'password_', 0, $app , @SW_MAXIMIZE)
EndIf

Whan do i have to do to get the variable to work inn the RunAsWait command?

Hmm??

RunAsWait('user', 'domain', 'password', 0, 'C:\path\to\my\command.exe ' & $variable, @SCRIPTDIR, @SW_MAXIMIZE)

Share this post


Link to post
Share on other sites
Erlend

Hmm??

RunAsWait('user', 'domain', 'password', 0, 'C:\path\to\my\command.exe ' & $variable, @SCRIPTDIR, @SW_MAXIMIZE)
ok, but the command i wish to run is the variable that i read from the ini file. is it posible to execute this?

Share this post


Link to post
Share on other sites
Erlend

Dim $appdir
$appdir = IniRead("s:\vismakiller\config.ini", "SERVERS", "appdir", "NotFound")
MsgBox(4096, "App er:", $appdir)
If Not IsAdmin() Then
RunAsWait('user_', "domain_", 'password_', 0, $appdir & '\vismakiller.exe')
MsgBox(0, "Info", "Ferdig!")
EndIf

What is wrong with the formatation of this scipt?

I can't work out how i can format the $appdir variable, the .ini file value looks like this \\server_\share$\_folder\ the vismakiller.exe application is in this folder.

Share this post


Link to post
Share on other sites
Jos

Where is this script stored? (in other words: what is your working directory and is that available for the shelled application?)


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Erlend

INI file:

[SERVERS]
appdir=\\server\share$\

The exe file is caled initkill.exe an is used to launch (from UNC path) vismakiller.exe as an user with administrator rights. For the normal user the initkill is stores at s:\vismakiller\

Vismakiller copy's some files and launch psexec to launch another script at a remote server.

i need to use the iniread because the same application is used against different serveres and shares.

Edited by Erlend

Share this post


Link to post
Share on other sites
Erlend

solved:

Opt("TrayIconHide", 1)

Dim $appdir
$appdir = IniRead("s:\vismakiller\config.ini", "SERVERS", "appdir", "NotFound")
If Not IsAdmin() Then
RunAsWait('user_', "domain_", 'password_', 0, @ComSpec & " /c " & '"' & $appdir & '"', "", @SW_HIDE)
EndIf

Share this post


Link to post
Share on other sites
Erlend

solved:

Opt("TrayIconHide", 1)

Dim $appdir
$appdir = IniRead("s:\vismakiller\config.ini", "SERVERS", "appdir", "NotFound")
If Not IsAdmin() Then
RunAsWait('user_', "domain_", 'password_', 0, @ComSpec & " /c " & '"' & $appdir & '"', "", @SW_HIDE)
EndIf

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.