Ad
News

Windows Media DRM cracked

Published on August 28, 2006

A user of the "Doom9" forums has posted software that claims to be able to remove the digital rights management scheme from Windows Media encoded music files. Read more

Sony nixes copy-protected CDs in Japan

Published on October 05, 2004

Sony's Japanese music unit says it will no longer sell CDs with built-in copy protection, a technology it had been pushing for two years. Read more

Windows Data Copy Limits Exposed, Sort Of

Published on April 25, 2008

Redmond (WA) - Is there a limit how many files you can copy in one step? Read more

Microsoft Access Falls Victim To Serious Flaw

Published on December 13, 2007

The United States Computer Emergency Readiness Team (US-CERT) has issued a warning about a newly discovered hack that could implant malicious software on a computer via Microsoft's database software program. Read more

Latest Reviews & Articles

Intel's Core i7: Blazing Fast, But Crippled O/C

Published on November 03, 2008

Core i7--previously referred to as Nehalem--requires new motherboards, coolers and memory. Its performance is compelling and means AMD is falling behind even further, but Intel is putting in some speed bumps that will impact overclocking enthusiasts. Read more

System Builder Marathon: Performance & Value

Published on October 31, 2008

Three dramatically different builds face off in a show of performance, defining the real value of each. Our mainstream system is designed to meet the needs of most users. Who should spend more and who can live with less? Read more

System Builder Marathon: $500 Gaming PC

Published on October 30, 2008

For the second to last day of our System Builder Marathon series, we add a $500 gaming PC to the mix. It's not going to be as quick as our other two builds, but we think Paul was able to get some serious value from this thing. Read more

Tom's SBM: The $1,500 Mainstream PC

Published on October 29, 2008

We're following up yesterday's $4,500 behemoth with a more affordable $1,500 mid-range build. Let's see what sort of performance (and overclocking headroom) you can get when you spend one third of the money. Read more

  Tom's Hardware Forums » Windows XP » Windows XP General Discussion » script to copy target files behind shortcuts
 

script to copy target files behind shortcuts




Word :   Username :  
 
Bottom
Author
 Thread : script to copy target files behind shortcuts
 
Profile: stranger
More Information

Hi all,

I'm trying to find a nice, simple way to copy the target file of a shortcut, not the shortcut itself. Ultimately I want to be able to copy a folder and all its contents, whether they be shortcuts or 'real' files, to a thumbdrive, etc.

I found a vbscript that does it (see http://groups.google.com/group/mic [...] 8e7870625), but this copies only the shortcut files (not real files in the same folder), and isn't too user-friendly: it needs to be edited for source and destination folders. I don't know anything about WSH, so can someone help with the following?:

1. Make it copy all files in the source folder, not just *.lnk files.
2. Make it ask the user for the source and destination folder. Preferably a nice navigable FileOpen box or whatever, but I suppose a text-only "Enter source path..." type deal would suffice.

3. Or, is there a program out there already that does this?

Here's the code from the above link, just in case:

' Note the trailing backslash!
sToFolder = "c:\test\dest\"

Set oShell = CreateObject("WScript.Shell" )
Set oFSO = CreateObject("Scripting.FileSystemObject" )

' If the files exist in the folder from before (from a previous run),
' none of them must be RO or the script below will err. To avoid this,
' script runs the attrib command to remove any RO flags.
oShell.Run "attrib.exe /s -r " & sToFolder & "*", 0, True

' Using the desktop folder as an example
'sFolderWithLinks = oShell.SpecialFolders("Desktop" )

' For a hard coded path, uncomment the following line and edit the path
sFolderWithLinks = "c:\test\source"

Set oFiles = oFSO.GetFolder(sFolderWithLinks).Files

For Each oFile In oFiles
If LCase(oFSO.GetExtensionName(oFile)) = "lnk" Then
Set oShellLink = oShell.CreateShortcut(oFile.Path)
sLinkTargetPath = oShellLink.TargetPath
If oFSO.FileExists(sLinkTargetPath) Then
oFSO.CopyFile sLinkTargetPath, sToFolder, True
End If
End If
Next



Thanks!


  Tom's Hardware Forums » Windows XP » Windows XP General Discussion » script to copy target files behind shortcuts

Go to:
 

Google Ads