Reputation: 39
it runs the script up until the if clause (for running url) I cannot include the other url here but the script is
"welcome, want to go to site?"
$goyn=read-host -prompt "enter y or n"
if($goyn -eq 'y'){
start-process -Filepath chrome.exe -ArgumentList www.google.ca
}
else{"continue on your journey of awesomeness"}
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Get-WmiObject -Class Win32_OperatingSystem -ComputerName localhost |
Select-Object -Property CSName,@{n="Last Booted";
e={[Management.ManagementDateTimeConverter]::ToDateTime($_.LastBootUpTime)}}
for the start-process it throws the error "cannot find file specified followed by the path for $profile. wanted a quicker way of of getting to my work service page.
Upvotes: 1
Views: 2449
Reputation: 39
So figured it out. it did not like start-process not one bit no matter how outrageously obvious I made the path. So I used the start cmdlet instead and put site in single quotes. Code looks like this:
"welcome, want to go to site?"
$goyn=read-host -prompt "enter y or n"
if($goyn -eq 'y'){
start 'www.google.ca'
}
else{"continue on your journey of awesomeness"}
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Get-WmiObject -Class Win32_OperatingSystem -ComputerName localhost |
Select-Object -Property CSName,@{n="Last Booted";
e={[Management.ManagementDateTimeConverter]::ToDateTime($_.LastBootUpTime)}}
Upvotes: 0
Reputation: 30662
Specify full path to chrome.exe
and other used items. E.g. C:\Program Files (x86)\Google\Application\chrome.exe
. Adjust %PATH% otherwise. But I'd better specify full path.
Upvotes: 1