Solved

Script to create URL shortcuts from a txt file

Posted on 2013-10-25
2
489 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 84

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

Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

Question has a verified solution.

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

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

730 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