Sign in to follow this  
Followers 0
chuck

Doudle Quote Single Quote with Variable

9 posts in this topic

Hallo to every AutoIt User

I have a little problem using the run command

When I m typing the command like this

run("explorer.exe c:\temp")

everything is ok

But When I m giving

$temp = "C:\temp"

run("explorer.exe" & $temp) or many combinations with single or double quotes I cannot have the same result as the first run hardcoded ...

Any Help Appreciated

Sorry if this is very easy for someone i tried many things before asking

Thaks a Lot

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

The way you have it written would return run("explorer.exec:\temp") instead of run("explorer.exe c:\temp")

What you want is

$temp = " C:\temp" < note the space

run("explorer.exe" & $temp)

or

$temp = "C:\temp"

run("explorer.exe " & $temp) < space here

Edit, typo

Edited by youknowwho4eva

Giggity

Share this post


Link to post
Share on other sites

My Friend youknowwho4eva thanks for your quick answer but

It's still not working even i tried the clever thing you proposed

run("explorer.exe c:\temp") opens me the contents of c:\temp directory

$temp = " c:\temp" leaving a space as you said

run("explorer.exe" & $temp) is not working at all

Share this post


Link to post
Share on other sites

All ways worked with me. Even without the space...


Giggity

Share this post


Link to post
Share on other sites

run('explorer.exe "c:\program files"')

this work fine too :D

Share this post


Link to post
Share on other sites

$dir = "C:\WINDOWS\system32"

run("calc.exe", $dir)

this one works for me!

Share this post


Link to post
Share on other sites

I've personally always used

$temp = "c:\temp"
ShellExecute($temp)

[b][/b]

Share this post


Link to post
Share on other sites

Thanks everyone

the shellexecute solution fits best for my case

But I m sure that theres a way with the run command

We ll see in the future

Share this post


Link to post
Share on other sites

Thanks everyone

the shellexecute solution fits best for my case

But I m sure that theres a way with the run command

We ll see in the future

$temp = "C:\temp"
run('explorer.exe "' & $temp & '"')

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