But trying to run that command via the function does not work. For, PowerShell throws an error when loading the profile that contains the function. If I remove the function from the profile and enter the function directly into PowerShell, and run that function, then the following happens.
function rclonegui() { Start "Rclone GUI" "C:\Portable_apps\rclone\rclone\rclone.exe gui" "--addr localhost:5580" }
$ rclonegui
Start-Process: A positional parameter cannot be found that accepts argument '--addr localhost:5580'.
I have tried several variants to no avail. The variants include:
not using 'Start';
combining the true arguments ('gui' and the '--addr' argument);
using a PowerShell alias rather than a PowerShell function.
PS C:\> & C:\Portable_apps\rclone\rclone.exe gui --addr localhost:5580 -vv
DEBUG : rclone: Version "v1.74.1" starting with parameters ["C:\\Portable_apps\\rclone\\rclone.exe" "gui" "--addr" "localhost:5580" "-vv"]
INFO : No username specified. Using default username: gui
INFO : No password specified. Using random password: pNotyyIV2TXmwahPyYUb-w
INFO : Using --user gui --pass XXXX as authenticated user
NOTICE: Serving remote control on http://127.0.0.1:62441/
NOTICE: Serving GUI version 1.1.7 on http://127.0.0.1:5580/
NOTICE: GUI available at http://127.0.0.1:5580/login?pass=pNotyyIV2TXmwahPyYUb-w&url=http%3A%2F%2F127.0.0.1%3A62441%2F&user=gui
Thank you for your reply. I fail to understand that reply. Are you soliciting debugging output? Are you suggesting that I use a particular command within my PowerShell profile?
# path of rclone.exe is NOT in $env:Path
function rclonegui()
{ Start -FilePath "C:\Portable_apps\rclone\rclone.exe" -ArgumentList "gui --addr localhost:5580 -vv" }
# path of rclone.exe is in $env:Path
function rclonegui() { rclone.exe gui --addr localhost:5580 -vv }
# add path to $env:Path
function rclonegui() {
$env:Path += ';C:\Portable_apps\rclone'
rclone.exe gui --addr localhost:5580 -vv }
Thanks all. I tried all of those variants within a batch file, and I think that they all worked (though getting a browser to launch seemed problemic). None of them worked via the profile. For instance,
function rclonegui() {
start "C:\Portable_apps\rclone\rclone.exe gui" "--addr=localhost:5580"
}
produced
start "C:\Portable_apps\rclone\rclone.exe gui" "--addr=localhost:5 …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| This command cannot be run due to the error: An error occurred trying to start process 'C:\Portable_apps\rclone\rclone.exe gui' with working directory 'C:\Users\nicholas'. The system cannot find the
| file specified.
Thanks, Nick. Both those options work. But no browser no opens. And trying to get a browser to open - from the function, or even just in a PowerShell terminal, or in a cmd.exe - does nothing, for some reason, and whichever way I try to start it and whether or not I use a portable Firefox installation.
Apologies: the problem was the program 'WindHawk', possibly in combination with the program 'Eset'; once Windhawk is unloaded, or firefox.exe is added to WindHawk's 'process exclusion' list, the following command works (as I suspect would several variants) when included within a function that itself resides within my PowerShell profile.
That particular command launches a portable version of Firefox, in the foreground, in a new tab if the portable Firefox is running already, and with a particular Firefox 'profile'.