Jump to content
Sign in to follow this  
simbo

FileCreateShortcut problems with Vista

Recommended Posts

simbo

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

Share this post


Link to post
Share on other sites
LurchMan

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.

Share this post


Link to post
Share on other sites
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.

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

Share this post


Link to post
Share on other sites
LurchMan

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.

Share this post


Link to post
Share on other sites
GodlessSinner

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

It's works.


_____________________________________________________________________________

Share this post


Link to post
Share on other sites
simbo

#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?

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  

×