search & create multiple FILES shortcuts from reference list

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
jamesfui
Posts: 50
Joined: 27 Mar 2010 23:00

search & create multiple FILES shortcuts from reference list

#1 Post by jamesfui » 17 Apr 2010 03:04

hi.. urgently need the scripts to do the following task;
need a batch script to create multiple "FILES shortcut" from a reference list.
for example,

ref.txt
---------------content-----------------
jan 2009
february 2010
march report

---------------content end-------------

the above files are saved in different folders as shown below;
c:\documents\old report\jan 2009.doc
c:\documents\new report\february 2010.doc
c:\documents\submitted\march report.doc

below is my script but is not working!! any guides will be very appreciate!!

set source="c:\documents"
set destination="c:\newdocuments"
for /f "usebackq delims=" %%a in ("ref.txt") do (
if exist %source%\"%%~a".doc (
"%windir%\system32\shortcut.exe" -n %destination%\"%%~na" %source%\"%%~a".doc
) else echo."%%~na">> notexist.txt
)

basically is to read the source files from the reference list & create these files shortcuts searching the main source from different folders&subfolders!!

any idea?? thanks :?

Post Reply