Kunal Posted November 8, 2007 Share Posted November 8, 2007 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 Link to comment Share on other sites More sharing options...
monoceres Posted November 8, 2007 Share Posted November 8, 2007 (edited) The correct syntax would be:FileCopy($link, "\\" & $inputbox &"\c:\Documents and Settings\All users\Desktop") Edited November 8, 2007 by monoceres Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Kunal Posted November 8, 2007 Author Share Posted November 8, 2007 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 helpKunal Link to comment Share on other sites More sharing options...
dabus Posted November 8, 2007 Share Posted November 8, 2007 (edited) $TEST=FileCopy($link, "\\" & $inputbox &"\c$\Documents and Settings\All users\Desktop\my_shortcut.lnk") If $TEST <> 1 Then MsgBox(16, "Error on ...", $inputbox) Edited November 8, 2007 by dabus Link to comment Share on other sites More sharing options...
rasim Posted November 8, 2007 Share Posted November 8, 2007 Hi, i tried to run it and it ran ok but did not place the shortcut on the target pc. thanks for your help KunalTry 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. Link to comment Share on other sites More sharing options...
dabus Posted November 8, 2007 Share Posted November 8, 2007 (edited) Only local drives use ":" like "c:" . Networks go with "$" like "\\127.0.0.1\c$" . Edited November 8, 2007 by dabus Link to comment Share on other sites More sharing options...
Kunal Posted November 8, 2007 Author Share Posted November 8, 2007 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now