Link to home
Start Free TrialLog in
Avatar of axcx
axcx

asked on

launching a random website from the command line

"start http://www.microsoft.com" launches a website from the command line. What should I do to launch a randomly selected website from a predefined pool?
ASKER CERTIFIED SOLUTION
Avatar of dlb6597
dlb6597

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Liam Somerville
Liam Somerville

This might be your ticket. I've modified it a bit for you. You'll need a "websites.txt" file containing your sites:

$Sites = Get-Content C:\websites.txt

$hash = @{}

foreach ($Site in $Sites)
{
    $hash.add($u,(Get-Random -Maximum $Sites.count))
} #end foreach

$PickedSite = $hash.GetEnumerator() | Sort-Object -Property value | Select-Object -First 1

start $PickedSite

Open in new window


I haven't tested this. Let me know if it works.