Jump to content
Sign in to follow this  
slightly_abnormal

Open A Folder Using A Variable?

Recommended Posts

slightly_abnormal

How do I run a folder, using a variable e.g

Opt("ExpandEnvStrings", 1)

$var2 = "notepad.exe"
run($var2)

$var1 = "%appdata%"
run($var1)

$var3 = "c:\"
run($var3)

I've tried the _rundos, and the run(@comspec, but i think they were totally off

this itself

$var2 = "notepad.exe"
run($var2)
works without a hitch but folders are another thing.. :)

Share this post


Link to post
Share on other sites
cppman

run("explorer.exe c:\")

or using variables:

run("explorer.exe " & $myvar)

hope that helps

:)

Edited by CHRIS95219

Share this post


Link to post
Share on other sites
slightly_abnormal

it didn't work :)

Opt("ExpandEnvStrings", 1)

$var2 = "notepad.exe"
run($var2)

$var1 = "%appdata%"
run("explorer.exe" & $var1)

$var2 = "c:\"
run("explorer.exe" & $var2)
Edited by slightly_abnormal

Share this post


Link to post
Share on other sites
forger

"explorer.exe " and NOT "explorer.exe" ( you forgot the space! :) )

Opt("ExpandEnvStrings", 1)

$var2 = "notepad.exe"
run($var2)

$var1 = "%appdata%"
run("explorer.exe " & $var1)

$var2 = "c:\"
run("explorer.exe " & $var2)

Share this post


Link to post
Share on other sites
slightly_abnormal

ahh i see.. :) thanks for the help guys

Share this post


Link to post
Share on other sites
greenmachine

Alternatively you can use Run (@ComSpec & " /c start C:\").

Share this post


Link to post
Share on other sites
slightly_abnormal

Alternatively you can use Run (@ComSpec & " /c start C:\").

oops.. how can i avoid the security dialog when I run a shortcut?

Opt("ExpandEnvStrings", 1)
$var2 = "notepad.lnk"
run("explorer.exe " & $var2)
Edited by slightly_abnormal

Share this post


Link to post
Share on other sites
greenmachine

oops.. how can i avoid the security dialog when I run a shortcut?

Opt("ExpandEnvStrings", 1)
$var2 = "notepad.lnk"
run("explorer.exe " & $var2)
Run (@ComSpec & ' /c "' & $var2 & '"') ; added surrounding quotes just in case there's a space.

Share this post


Link to post
Share on other sites
slightly_abnormal

Run (@ComSpec & ' /c "' & $var2 & '"') ; added surrounding quotes just in case there's a space.

cool, thanks :)

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.