Jump to content

Recommended Posts

Posted

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.. :)
Posted (edited)

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
Posted

"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)
Posted (edited)

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
Posted

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.

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
×
×
  • Create New...