
Untitled
By: a guest on
May 31st, 2012 | syntax:
None | size: 0.70 KB | hits: 14 | expires: Never
How do I create an object based on the output of a Function in Power Shell?
Function GET-DefaultBrowserPath {
#Get the default Browser path
New-PSDrive -Name HKCR -PSProvider registry -Root Hkey_Classes_Root | Out-Null
$browserPath = ((Get-ItemProperty 'HKCR:httpshelopencommand').'(default)').Split('"')[1]
return $browserPath
}
GET-DefaultBrowserPath
$IE = new-object internetexplorer.application
$IE.navigate2("www.microsoft.com")
$IE.visible=$true
$browser_object = new-object -com $browserPath.application
$browser_object = new-object -com firefox.application
Start-Process $url
$path = GET-DefaultBrowserPath
$url = "www.microsoft.com"
&$path $url