Jump to content

FileCreateShortcut problems with Vista


Recommended Posts

Hi All.

One of my scripts creates a shortcut to itself in the user's startup directory like this:-

FileCreateShortcut(@ScriptFullPath, @StartupDir & "\myprog.lnk")

This works fine.

When I try and create a similar shortcut in the common startup directory like this...

FileCreateShortcut(@ScriptFullPath, @StartupCommonDir & "\myprog.lnk")

It returns zero and doesn't work.

I assume Vista is blocking it because if I try and do it manually I get "Destination Folder Access Denied", have to click Continue and then User Account Control asked me to click continue as well. (Why do I have to tell them twice?! But that's another issue). Windows doens't throw any error messages or prompts when I run my script, it just doesn't work.

I can't just turn off UAC because it will be used on other people's machines as well.

Can I do something with the optional arguments when using FileCreateShortcut? to give the command Admin priviledges or something?

Thanks in advance

Simbo

Link to comment
Share on other sites

Hi All.

One of my scripts creates a shortcut to itself in the user's startup directory like this:-

FileCreateShortcut(@ScriptFullPath, @StartupDir & "\myprog.lnk")

This works fine.

When I try and create a similar shortcut in the common startup directory like this...

FileCreateShortcut(@ScriptFullPath, @StartupCommonDir & "\myprog.lnk")

It returns zero and doesn't work.

I assume Vista is blocking it because if I try and do it manually I get "Destination Folder Access Denied", have to click Continue and then User Account Control asked me to click continue as well. (Why do I have to tell them twice?! But that's another issue). Windows doens't throw any error messages or prompts when I run my script, it just doesn't work.

I can't just turn off UAC because it will be used on other people's machines as well.

Can I do something with the optional arguments when using FileCreateShortcut? to give the command Admin priviledges or something?

Thanks in advance

Simbo

Why don't you just create a registry key for startup for the script (if its compiled). Not sure where its at in vista search google to find it.

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Link to comment
Share on other sites

Why don't you just create a registry key for startup for the script (if its compiled). Not sure where its at in vista search google to find it.

Thanks LurchMan,

I had initially rejected that because some anti-vrius programs seem to notice my scripts fiddling with the registry and give my users scary sounding error messages, but I may well have to unless someone else has a way around the UAC?

Regards,

Matt

Link to comment
Share on other sites

thats vistas wonderful security that everyone loves so much. In XP i can edit reg info without AV even caring (which can be good and bad :D )

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Link to comment
Share on other sites

#requireadmin
FileCreateShortcut(@ScriptFullPath, @StartupCommonDir & "\myprog.lnk")

It's works.

I've just given it a try and it makes UAC appear every time. With Vista even Admins have to click continue to make system changes.

I think I shall have to use the registry, unless I'm missing something?

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...