?
Solved

Script to create URL shortcuts from a txt file

Posted on 2013-10-25
2
Medium Priority
?
498 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 85

Accepted Solution

by:
oBdA earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article will help you understand what HashTables are and how to use them in PowerShell.
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.
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

771 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