CreateShortcut on Desktop from a variable drive
Posted on 2013-01-27
I need to copy 2 executables from a External Hard Drive to a small 8 gig drive through a batch file. The drive letter on the 8 gigabyte drive can vary. Is there a way to do that where it auto searches for the Drive, then copies the 2 files?
Once they are copied over to the 8 gig USB flash drive, I need to create shortcuts for both on the desktop. Now since the drive lettter can vary, I have no idea on how that can be accomplished.
This is what I have used if I know the drive letter. If it is something other then F, I do not know how I can account for that?
allusersdesktop = "C:\Documents and Settings\All Users\Desktop"
set WshShell = WScript.CreateObject("WScript.Shell")
set oShellLink = WshShell.CreateShortcut(allusersdesktop & "\Transfer.lnk")
oShellLink.TargetPath = "F:\File Transfer.exe"
oShellLink.WindowStyle = 1
oShellLink.IconLocation = "%SystemRoot%\system32\SHELL32.dll,100"
oShellLink.Description = "Transfer"
oShellLink.WorkingDirectory = "f:\test"