Computing.Net > Forums > Windows XP > VB Script help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

VB Script help

Reply to Message Icon

Name: compu-angus
Date: September 19, 2007 at 13:28:28 Pacific
OS: winxp-sp2
CPU/Ram: 512mb
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: September 19, 2007 at 15:44:41 Pacific
Reply:

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.


0

Response Number 2
Name: justcuz (by whitevalley)
Date: September 19, 2007 at 20:57:41 Pacific
Reply:

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.



0

Response Number 3
Name: compu-angus
Date: September 20, 2007 at 07:12:04 Pacific
Reply:

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?


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: VB Script help

VBS script to find files www.computing.net/answers/windows-xp/vbs-script-to-find-files/156696.html

VBS script www.computing.net/answers/windows-xp/vbs-script/177893.html

MY PICTURES TURNED TO VB SCRIPT FILES!! www.computing.net/answers/windows-xp/my-pictures-turned-to-vb-script-files/9719.html