Solved

Script to create URL shortcuts from a txt file

Posted on 2013-10-25
2
474 Views
Last Modified: 2013-10-25
Experts,

Can someone help me create a script that will create a URL shortcut file from a list of computers in a txt file.

So, for every server in the .txt file, create "C:\Folder\<servername>.URL" and pipe this text into that file:

[InternetShortcut]
URL=http://<servername>/

Thanks in advance,

A.
0
Comment
Question by:Angeal
2 Comments
 
LVL 83

Accepted Solution

by:
oBdA earned 500 total points
ID: 39600629
Try this; the URL files will be created in the same folder as the text file (specified in the variable "InputFile")
@ECHO OFF
setlocal enabledelayedexpansion
set InputFile=D:\Temp\ServerList.txt
for %%a in ("%InputFile%") do (set Folder=%%~dpa)
for /f %%a in ('type "%InputFile%"') do (
	set ShortcutFile=%Folder%\%%a.URL
	echo Creating !ShortcutFile! ...
	 >"!ShortcutFile!" echo [InternetShortcut]
	>>"!ShortcutFile!" echo URL=http://%%a/
)

Open in new window

0
 

Author Closing Comment

by:Angeal
ID: 39601227
Thanks a lot oBdA! Exactly was I was looking for.

Cheers,

A.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Windows Server Update Service (WSUS) is free for everyone, but it lacks of some desirable features like send an e-mail to the administrator with the status of all computers on the WSUS server. This article is based on my PowerShell script …
In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now