Solved

Script to create URL shortcuts from a txt file

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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
A procedure for exporting installed hotfix details of remote computers using powershell
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

860 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