Jump to content

Recommended Posts

Posted

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

Posted (edited)

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!

Posted

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

Posted

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.

Posted (edited)

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

Edited by dabus
Posted

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

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
×
×
  • Create New...