Jump to content
Sign in to follow this  
Kunal

remote shortcut

Recommended Posts

Kunal

Hi, i need to put a shortcut on a remote computer and have it ask for what is the target pc.

below is what i have but it doesnt work when i run it in autoit

Global $inputbox = InputBox("What's the computer name?", "Please provide Computer Name?")

Global $link = @DesktopDir & "\my_shortcut.lnk"

FileCopy($link, "\\" & $inputbox "\c$\Documents and Settings\All users\Desktop")

Can anyone help?

Thanks

Kunal

Share this post


Link to post
Share on other sites
monoceres

The correct syntax would be:

FileCopy($link, "\\" & $inputbox &"\c:\Documents and Settings\All users\Desktop")

Edited by monoceres

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
Kunal

The correct syntax would be:

FileCopy($link, "\\" & $inputbox &"\c:\Documents and Settings\All users\Desktop")

Hi,

i tried to run it and it ran ok but did not place the shortcut on the target pc.

thanks for your help

Kunal

Share this post


Link to post
Share on other sites
dabus

$TEST=FileCopy($link, "\\" & $inputbox &"\c$\Documents and Settings\All users\Desktop\my_shortcut.lnk")
If $TEST <> 1 Then MsgBox(16, "Error on ...", $inputbox)

Edited by dabus

Share this post


Link to post
Share on other sites
rasim

Hi,

i tried to run it and it ran ok but did not place the shortcut on the target pc.

thanks for your help

Kunal

Try it:

$comp_name = InputBox("What's the computer name?", "Please provide Computer Name?")

If Not $comp_name = "" Then
    FileCreateShortcut(@ProgramFilesDir & "\MyProgram\file.exe", @ScriptDir & "\file.lnk", @ProgramFilesDir & "\MyProgram")
    FileCopy(@ScriptDir & "\file.lnk", "\\" & $comp_name & "\c:\Documents and Settings\All users\Desktop")
EndIf

A function FileCreateShortcut() returned 1 if success or 0 if lnk cannot be created, but not returned path and name to lnk file.

Share this post


Link to post
Share on other sites
dabus

Only local drives use ":" like "c:" . Networks go with "$" like "\\127.0.0.1\c$" .

Edited by dabus

Share this post


Link to post
Share on other sites
Kunal

Only local drives use ":" like "c:" . Networks go with "$" like "\\127.0.0.1\c$" .

Oh ok, from the script above. How do i set the vars so that it reads the file form a network share as in \\server , just not sure on what to put as the variables to get the script working.

thanks

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.