There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
script - create folders containing shortcuts to programs


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
lortemort's Avatar
Junior Member with 3 posts.
 
Join Date: Jan 2007
04-Jan-2007, 05:16 PM #1
script - create folders containing shortcuts to programs
Hi,I tend to do the following alot:
Create multiple folders, give them specific names
open the folders, fill them with shortcuts to programs
change the names of the shortcuts
change the icons of the shortcuts

So I am wandering, is it possible to create a script to do the above?

1.) create several folders, give them different names
2.) fill the folders with shortcuts to programs having the correct names and icons
Rollin_Again's Avatar
Distinguished Member with 2,834 posts.
 
Join Date: Sep 2003
Location: Atlanta, GA - Planet Earth
Experience: Brilliant When Sober
05-Jan-2007, 03:32 PM #2
Copy the code below into a text file and rename the .txt extension to .vbs

Just change the "Create Folder Path" (line 2) to reflect where you want the destination folder to be created. Also change the Save Path and Link name in line 4 as well as the Target path of your application in line 5. Save the file and then double click to execute. You will need to refresh your desktop or directory by clicking F5 in order to show the newly created folder. In my example below I copied the file MSConfig.exe to the root of my C: drive and then used the script to create a shortcut to it inside the folder "Test" on my desktop. I'm not sure how to change the icons via code so maybe someone else could help out ??

Code:
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.CreateFolder("C:\Documents and Settings\euza116\Desktop\Test")
Set objShell = WScript.CreateObject("WScript.Shell")
Set objShortCut = objShell.CreateShortcut("C:\Documents and Settings\euza116\Desktop\Test\Your_Link_Name.lnk")
objShortCut.TargetPath = "C:\MSConfig.exe"
objShortCut.Description = "Shortcut_to_ MSConfig"
objShortCut.Save

Here is the same code in VBA Just change the path names to reflect the correct application and save paths. You can add this code to a module within MS Word or Excel or other MS Office Application.

Code:
Public Sub CreateDirectory()

Set objShell = CreateObject("WScript.Shell")
MkDir ("C:\Documents and Settings\euza116\Desktop\Test")
Set objLink = objShell.CreateShortcut("C:\Documents and Settings\euza116\Desktop\Test\Your_Link_Name.lnk")
objLink.TargetPath = "C:\MSConfig.exe"
objLink.WindowStyle = 1
objLink.Description = "MSConfig_Shortcut"
objLink.Save

End Sub

Regards,
Rollin
__________________
Protect your computer and keep it free of pests and other spyware. Download AdAware, Spybot, ZoneAlarm and lots of other great utilities at PC World / SnapFiles / Major Geeks, Tech Guy Stuff

Help Keep this site free by making a small donation

http://www.techguy.org/donate.html

Last edited by Rollin_Again : 05-Jan-2007 05:00 PM.
lortemort's Avatar
Junior Member with 3 posts.
 
Join Date: Jan 2007
07-Jan-2007, 12:45 AM #3
Thank you very much, Rollin the code worked like a charm on the first run.

For .exe programs the correct icons are there, but I have .bat files I have to change icons on manually so now I will just sitt back and wait for the answer to the icon problem.

I am very satisfied, thanks again.
lortemort's Avatar
Junior Member with 3 posts.
 
Join Date: Jan 2007
08-Jan-2007, 12:54 AM #4
Solved !!
I think that adding this to the .vbs will do it:
objShortcut.IconLocation = "c:\avpersonal.ico"
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 03:28 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.