My code now creates a shortcut to first row in "list.txt", with correct name (as last folder in target of shortcut called), but I need to do the same process with whole "list.txt", for each row, as if I added 'skip=1', then 'skip=2'..... to 'for /f' for each row:
for /f "skip=1 usebackq delims=" %%G IN (List.txt) DO if not defined line set "line=%%G"
I can't repeat this process in one bat file to each row. How to do that?
@echo off
Setlocal EnableExtensions
for /f "usebackq delims=" %%G IN (List.txt) DO if not defined line set "line=%%G"
set LNKNAME=%line:~0%
for %%f in ("%LNKNAME%") do set LNKNAME_A=%%~nxf
SET SAVETO=%userprofile%\desktop
call :createLink "%LNKNAME_A%" "%line%"
pause
rem createLink <linkname> <target>
:createLink
set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
echo sLinkFile = "%SAVETO%\%~1.lnk" >> %SCRIPT%
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
echo oLink.TargetPath = "%~2" >> %SCRIPT%
echo oLink.Save >> %SCRIPT%
cscript /nologo %SCRIPT%
del %SCRIPT%
EXIT /B 0
rem goto :eof