Page 1 of 1

search & create multiple FILES shortcuts from reference list

Posted: 17 Apr 2010 03:04
by jamesfui
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 :?