Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Friday, October 25, 2019 12:16 AM
I need to launch firefox.exe with url in PS and tried the followings with error. I tried to add its path to environment variable PATH but still not working. any suggestion? Thanks
==========================================================================
PS C:\ .\firefox.exe -url https://www.google.com
.\firefox.exe : The term '.\firefox.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
At line:1 char:1
- .\firefox.exe -url https://www.google.com
-
+ CategoryInfo : ObjectNotFound: (.\firefox.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
==========================================================================
PS C:\ Start-Process "firefox.exe -url https://www.google.com"
Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
At line:1 char:1
- Start-Process "firefox.exe -url https://www.google.com"
-
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
All replies (5)
Friday, October 25, 2019 12:19 AM ✅Answered
X:\path-to-firefox\firefox.exe "http://website-to-launch.com/yadda"
Friday, October 25, 2019 9:10 PM ✅Answered
All the replies have problems. This might be the easiest way:
start firefox yahoo.com
Or
start firefox '-url',https://www.google.com # -args is an array
# firefox opts need quotes
start firefox '-url https://www.google.com' # or this way
Or even this if firefox is your default browser:
start http://yahoo.com
Adding to your path in your $profile:
$env:path += ';C:\Program Files\Mozilla Firefox'
firefox yahoo.com
Running the full path is tricky. You'd either have to use the call operator with a quoted path, or backtick escape the spaces (and parentheses in the 32-bit version).
& 'C:\Program Files\Mozilla Firefox\firefox.exe' # tab completion forms this
C:\Program` Files\Mozilla` Firefox\firefox.exe
C:\Program` Files` `(x86`)\Mozilla` Firefox\firefox.exe
cd 'C:\Program Files\Mozilla Firefox'; .\firefox
Friday, October 25, 2019 8:40 AM
Hi,
Thanks for your question.
You need to use the absolute path for your .exe file. Or use "set-location" cmdlet to set the location to the path where the file located.
set-location "The folder path where the file is located"
Start-Process "firefox.exe" -url "https://www.google.com"
Best regards,
Lee
Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact [email protected].
Friday, October 25, 2019 1:17 PM
PS C:\ "C:\Program Files\Mozilla Firefox\firefox.exe" -url https://www.google.com
At line:1 char:48
- "C:\Program Files\Mozilla Firefox\firefox.exe" -url https://www.googl ...
+ ~~~~
Unexpected token '-url' in expression or statement.
At line:1 char:53 - ... rogram Files\Mozilla Firefox\firefox.exe" -url https://www.google.com
+ ~~~~~~~~~~~~~~~~~~~~~~
Unexpected token 'https://www.google.com' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken
Friday, October 25, 2019 1:21 PM
PS C:\ set-location "C:\Program Files\Mozilla Firefox\
PS C:\Program Files\Mozilla Firefox> Start-Process "firefox.exe" -url "https://www.google.com"
Start-Process : A parameter cannot be found that matches parameter name 'url'.
At line:1 char:29
- Start-Process "firefox.exe" -url "https://www.google.com"
+ ~~~~
+ CategoryInfo : InvalidArgument: (:) [Start-Process], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.StartProcessCommand