Wednesday, 11 September 2013

Opening an HTA file from Powershell

Opening an HTA file from Powershell

I am trying to create a powershell script that will open an HTA file, but
only if it can see an html file in the same folder.
I have the following script from another question on stackoverflow, but
cannot seem to get it to work - can someone please point me in the right
direction?
The first part determines the name of the html file (called
Textbox1.html). The next part sets the file path as \network
location\Textbox1.html Then the final part says that if Textbox1.html
exists, open \network location\HTA3.hta
function GetTextboxExists
{
$TextboxExists = "$Textbox1.html"
return $TextboxExists
}
$filename = TextboxExists
$filePath = "\\*****path to file" + $filename
if ([IO.File]::Exists($filePath) -ne $true)
{
& "\\*****path to file\HTA3.hta"
}
Thanks, Roy

No comments:

Post a Comment