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

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

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

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

#1 Post by jamesfui » 14 Apr 2010 09:39

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

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

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

#2 Post by !k » 14 Apr 2010 13:38

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

Post Reply