Page 1 of 1

Create multiple 'FILES shortcut' on same prefix name!!

Posted: 14 Apr 2010 09:39
by jamesfui
HI dostips batch scripters experts..
do anyone know how to create multiple "FILES shortcut" on the same prefix file names!!

for example;
c:\documents\report\Pic A1.pdf
c:\documents\report\Pic A23.pdf
c:\documents\report\Pic A345.pdf

i have the common name as 'Pic A' but how do i create the
"files shortcut" for the fix prefix using just short scripts?? :?

my scripts show below;

SET /P fn=Pic A
"%windir%\system32\shortcut.exe" -n c:\documents\"%fn%" "c:\documents\report\"%fn%"*.pdf"

so that it will be like below;
c:\documents\Pic A1.lnk
c:\documents\Pic A23.lnk
c:\documents\Pic A345.lnk

thanks in advance!!! :D

Re: Create multiple 'FILES shortcut' on same prefix name!!

Posted: 14 Apr 2010 13:38
by !k

Code: Select all

@echo off
set "location=c:\documents\report"
set "link=c:\documents"

set /p fn=Enter prefix, ex.: Pic A
pushd "%link%"
for %%i in ("%location%\%fn%*.*") do (
shortcut.exe -f -t "%%i" -n "%%~ni" -d "%location%"
)
popd