Solved

Script to create URL shortcuts from a txt file

Posted on 2013-10-25
2
472 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
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 …
This video discusses moving either the default database or any database to a new volume.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

707 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

15 Experts available now in Live!

Get 1:1 Help Now