As the title says - is there a batch script (preferably with an example) that I could use t开发者_运维问答o add bookmarks to Internet Explorer specifically?
Thanks.
Using a command file
echo [InternetShortcut] > "%userprofile%\Desktop\Google.URL"
echo URL=http://www.google.com >> "%userprofile%\Desktop\Google.URL"
echo IconFile=http://www.google.com/favicon.ico >> "%userprofile%\Desktop\Google.URL"
echo IconIndex=0 >> "%userprofile%\Desktop\Google.URL"
You can use VBScript for creating .URL files. This one will put the shortcut on the desktop but you can put them somewhere else if you like.
set WshShell = WScript.CreateObject("WScript.Shell")
desktopFolder = WshShell.SpecialFolders("Desktop")
set link = WshShell.CreateShortcut(desktopFolder & "\Stack Overflow.url")
link.TargetPath = "http://stackoverflow.com"
link.Save
.stompp
Internet Explorer favorites are just text files with the .url extension formated like an .ini file that live in the user's Favorites folder.
You can't get the Favorites folder with the cmd processor (i.e. you can't get a direct path to the Favorites folder using a traditional batch file), the best you can do is assume that something like cd /d %USERPROFILE%\Favorites
will work.
Using the WScript stuff is probably a better solution.
精彩评论