Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
can someone look the vbs script below, this script is to create short-cut program on user's desktop. What if I want to copy instead of create short-cut? How do I change the script syntax, thanks! I am newbie at vbscript.
''Create new shortcut with correct path.
Set objShell = WScript.CreateObject("WScript.Shell")
strDesktopFld = objShell.SpecialFolders("Desktop")
Set objURLShortcut = objShell.CreateShortcut(strDesktopFld & "\afile.url") '' Name for Shortcut to add
objURLShortcut.TargetPath = "\\domain\file$\afile.exe" '' Path for shortcut
objURLShortcut.Save

This should probably be on the programming forum, but whatever.
What if I want to copy instead of create short-cut?
Then the syntax changes completely! Joy! (quick, dirty, and untested)
CreateObject("Scripting.FileSystemObject").CopyFile "\\domain\file$\afile.exe", CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\"Oh, that line of code is messy and probably shouldn't be used by a beginner, but it is perfectly valid.
EDIT: Changes to code in bold.

This is your 3rd separate post in 2 days, presumably regarding the same "problem". The "problem" may well be your strategy, not the implementation, ever think of that?
It appears you still have not made up your mind (or have you?), whether you want to copy that ".exe" or that "batch" file, or now that "vbscript", to the still undetermined location...etc...yada-yada-yada...etc.
Suggestion: state to the people here, what your starting point is (full disclosure), and what your intended end-point is (the END-point!!), and let them map out a strategy, and the methods/path/steps to get there.
For all I know, having followed (with some difficulty) your less-than-forthright posts, you may be asking for a method to infect "all users" on that 200-user network... There has been absolutely not a thing to suggest otherwise.

Thanks, I tried to use your code, but it didn't work, may be I am missing some parameter. Do you mind to send me complete source code?

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |