I am currently trying to write my first batch script ever.
What it does:
it gets all files from a certain folder and puts each of it in a rar
it generates an URL shortcut for the desktop
So far everything works fine, but here is the problem: I would like to create the shortcuts with unique URLs. Right now I am simply passing the URL via the script like this:
script.bat http://example.com
And the script does the following:
SET LINK =%1
::For each file that is in the dir "Ori"
FOR %%i IN (%BASEPATH%\Ori\*.*) DO (
echo [InternetShortcut] > "%BASEPATH%\New\%%~ni.URL"
echo URL=%LINK% >> "%BASEPATH%\New\%%~ni.URL"
echo IconFile=%LINK%/favicon.ico >> "%BASEPATH%\New\%%~ni.URL"
echo IconIndex=0 >> "%BASEPATH%\New\%%~ni.URL"
)
Of course this way, all Shortcuts will lead to http://example.com.
I would like to be able to define an unique URL for each shortcut that is being created.
Since I am a total beginner, I dont really know where to start... and was hoping for a suggestion!
P.S. Just to give you an idea what I would need, but this doesnt work:
script.bat {http://example.com,http://example1.com,http://example2.com}
And than the script should use URL 1 for the first shortcut, URL 2 for the second and so on.
Update:
It works fine now following jeb´s answer below. However, I was wondering: would it be possible to do the same job again with another variable? So that it looks kinda like this:
script.bat http://example.com http://example1.com http://example2.com NewVar1 NewVar2 NewVar3
And the NewVar should be saved just like:
SET NEWVAR=%2
How could I make the script know when the URL variables are done and the NewVar variables start?
And than be called like
!NEWVAR!