ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

IDEA: Create shortcuts from a list

<< < (2/7) > >>

lanux128:
XXMKLINK also works similarly but after thinking about it, i kinda prefer a Gui-ish tool..

Ruffnekk:
sometimes i need to create quickly shortcuts but the right-click/drag-drop is a bit slow at times. i have a list which i would like a program to go through and create individual shortcuts for each item in the list.

so, i am wondering if there is a program that could create shortcuts (*.lnk) from a text list containing file and/or folder.. can anyone help me out?
-lanux128 (November 20, 2006, 10:08 PM)
--- End quote ---

Okay so what format is the text file in? Something like <full source path> <full destination path> <shortcut name> <icon source> ?? Or is the destination always the same folder or the desktop? A bit more info and I can create a quick tool for it I think.

Regards,
Ruffnekk

lanux128:
it's in plain-text file, something like a "dir /b" output.. additionally if i can specify shortcut name, then it's fine..
this is how the list looks like: List-of-filesC:\Tools\bintext.exe
C:\Tools\checkdotnet.exe
C:\Tools\CloseAll.exe
C:\Tools\Contig.exe
C:\Tools\cpuz.exe
C:\Tools\DAMN NFO Viewer.ico
C:\Tools\datestat.exe
C:\Tools\Dr.exe
C:\Tools\Flashpla.exe
C:\Tools\K-TaskMod.exe
C:\Tools\ListFonts.exe
C:\Tools\mplayerc.exe

thesteve:
@lanux128:

I'm a brandy-new member here, so please be tolerant of my ignorance of protocol.

I wrote a small VBScript that appears to suit your needs. I don't see a way to upload this to DonationCoder, and I should have been in bed hours ago so I'm not going to go and upload it to my website, so I've placed the source code inside the nifty code tags:

--- ---'*********************************************
'** ShortcutCreator
'*********************************************
'** Author: Steve Perkins Date: 11/23/06
'** Purpose:
'**  This VBScript allows the user to
'**  specify a file containing paths to
'**  shortcuts and possibly shortcut names and
'**  creates shortcuts on the user's desktop
'**  according to the specifications.
'**
'** REQUIREMENTS:
'**  You must have Windows Script Host installed
'**  (http://www.microsoft.com/downloads/details.aspx?FamilyId=C717D943-7E4B-4622-86EB-95A22B832CAA&displaylang=en
'**  OR http://browse.files.filefront.com/Windows+Script+Windows+v560/;1652432;/browsefiles.html
'**  if you don't want to validate your copy of Windows).
'**
'** USAGE:
'**  Open a command prompt and type wscript ShortcutCreator.vbs /file:[shortcutDataFile.txt].
'**
'** NOTES:
'**  With this utility you can either let the program
'**  figure out shortcut display names or specify
'**  them in the file. If you do not specify shortcut
'**  names, this script will strip the filename
'**  from the path the shortcut points to and remove
'**  the file extension and use the remainder as
'**  the shortcut's display name.
'**  IF YOU WANT TO SPECIFY SHORTCUTS NAMES, put them
'**  after the path of the shortcut, separating the ]
'**  two values with a comma.
'**  EXAMPLE: C:\Program Files\Fortitude.exe, Fortitude Shortcut
'**
'**  You can specify some shortcuts with display names
'**  and some without in the same data file.
'**
'**  This script has no useful comments. It was put together
'**  specifically for a user on DonationCoder.com.
'*********************************************

Dim shortcut_file

Set args = WScript.Arguments.Named

shortcut_file = args.Item("file")

If shortcut_file = "" Then
Wscript.Echo "Usage: ShortcutCreator.vbs /file:filepath"
Else
Dim objFSO, objTextFile, WshSysEnv, sh
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(shortcut_file, 1, False)
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshSysEnv = WshShell.Environment("PROCESS")
dim root
root = WshSysEnv("USERPROFILE")

Set sh = WScript.CreateObject("WScript.Shell")
Do Until objTextFile.AtEndOfStream
Dim file_name
Dim shortCutName
Dim splut
Dim pos, array_len
shortCutPath = objTextFile.ReadLine
splut = Split(shortCutPath, ",")
array_len = UBound(splut)

If array_len > 0 Then
shortCutPath = splut(0)
End If
If array_len >= 1 Then
shortCutName = splut(1)
file_name = shortCutName
Else

pos = Len(shortCutPath) - InStrRev(shortCutPath, "\")
file_name = Right(shortCutPath, pos)

pos = Len(file_name) - 4
file_name = Left(file_name, pos)
shortCutName = file_name
End If

Set shortCutLink = sh.CreateShortcut(root & "\Desktop\" & shortCutName & ".lnk")
shortCutLink.TargetPath = shortCutPath
shortCutLink.WindowStyle = 1

shortCutLink.Description = file_name
shortCutLink.Save
Loop

objTextFile.Close
WScript.Echo("Finished.")
End If

I don't know how familiar you are with WSH and VBScript, so a quick instruction guide:
1. Copy the code I've presented to you and paste it into a new text document.
2. Rename the text document with a .vbs extension.
3. Run the little snot from the command line using the syntax wscript [whatever].vbs /file:[directory\]shortcutPathsFile.txt

I won't check back until after Thanksgiving, so if you have questions I'll be glad to answer them then.

lanux128:
welcome aboard, thesteve!
don't worry about protocols.. the folks here at DC are very tolerant & forgiving.. ;)
your script looks cool.. i'm gonna try this out later today and will let you know if it works for me..

thanks again! :Thmbsup:

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version