Sign in to follow this  
Followers 0
Boss007

help needed using variable to run a program

5 posts in this topic

I am a novice at scripting and would like some one to point me in the right direction for the code below

$ilocation = "c:"

MsgBox(0, "", $ilocation)

;how do I run a program using the content of the variable assigned above?

;the line below which i have tried many variations of does not work

;Run $ilocation ("\temp\myprogram.exe")

; the line below is what im trying to achieve using $ilocation in place of the "c:" so that if I change" $ilocation" the install path

; changes

;run ("c:\temp\myprogram.exe")

any help would be appriciated thanks!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You need to put all the data within the brackets and an amprisand will be used to seperate the two peices of data. Try something like this.

ShellExecute($ilocation & "tempmyprogram.exe") ; We use an amprisand to seperate the two peices of data

You can also use functions such as @DesktopDir to make things shorter for you.

Edited by Venix

Share this post


Link to post
Share on other sites

Concatenate your string!

$ilocation = "c:"

$Path = "tempmyprogram.exe"

run ($ilocation&$Path)

HTH!

Share this post


Link to post
Share on other sites

You need to put all the data within the brackets and an amprisand will be used to seperate the two peices of data. Try something like this.

ShellExecute($ilocation & "tempmyprogram.exe") ; We use an amprisand to seperate the two peices of data

You can also use functions such as @DesktopDir to make things shorter for you.

thank you very much for taking the time out it worked!

You need to put all the data within the brackets and an amprisand will be used to seperate the two peices of data. Try something like this.

ShellExecute($ilocation & "tempmyprogram.exe") ; We use an amprisand to seperate the two peices of data

You can also use functions such as @DesktopDir to make things shorter for you.

thanks very much for the explanation it worked!

Share this post


Link to post
Share on other sites

thank you very much for taking the time out it worked!

thanks very much for the explanation it worked!

You need to put all the data within the brackets and an amprisand will be used to seperate the two peices of data. Try something like this.

ShellExecute($ilocation & "tempmyprogram.exe") ; We use an amprisand to seperate the two peices of data

You can also use functions such as @DesktopDir to make things shorter for you.

thank you very much it worked!

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  
Followers 0