Jump to content
Sign in to follow this  
Docfxit

Syntax error running a .LNK

Recommended Posts

Docfxit

I can't figure out the correct syntax.

I'm trying to execute a lnk with:

Run(@ComSpec & " /c " & '"C:\Users\" & @UserName & "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Pegasus Mail\Pegasus Mail.lnk"', "", @SW_HIDE)

What I end up with is:

"C:\Users\" & @UserName & "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Pegasus Mail\Pegasus Mail.lnk"

If I run this:

Run(@ComSpec & " /c " & "C:\Users\" & @UserName & "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Pegasus Mail\Pegasus Mail.lnk", "", @SW_HIDE)

What I end up with is:

C:\Users\Jim\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Pegasus Mail\Pegasus Mail.lnk

When I execute it in a cmd line it runs this:

C:\Users\Jim\AppData\Roaming\Microsoft\Windows\Start

Does anyone know the correct syntax?

Thank you,

Docfxit

Share this post


Link to post
Share on other sites
Richard Robertson

Run(@ComSpec & " /c " & '"C:\Users\' & @UserName & '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Pegasus Mail\Pegasus Mail.lnk"', "", @SW_HIDE)

Share this post


Link to post
Share on other sites
Docfxit

Run(@ComSpec & " /c " & '"C:\Users\' & @UserName & '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Pegasus Mail\Pegasus Mail.lnk"', "", @SW_HIDE)

That fixed it. It's so nice of you to show me the correct way.

Thank you very much,

Docfxit

Share this post


Link to post
Share on other sites
Richard Robertson

Quotes can be difficult in strings. A lot of us have trouble now and then.

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.