Getting an error trying to invoke power shell

Command trying to access :- “& ““C:\Program Files\Google\Chrome\Application\chrome.exe”” --lang=en --accept-lang-en --incognito”

Getting this Error :-
image

Hi @Anurita_Mishra

Welcome to UiPath,

Pls try this:
& “C:\Program Files\Google\Chrome\Application\chrome.exe” --lang=en --accept-lang-en --incognito

I think the issue is the extra set of quotes- remove them and keep only one pair around the path.

If helpful, mark as solution. Happy automation with UiPath

Copy–paste this EXACTLY into CommandText:

“& ““C:\Program Files\Google\Chrome\Application\chrome.exe”” --lang=en --accept-lang=en --incognito”

Hi @Anurita_Mishra

Please remove the extra quotes form there and assign the path into the assign activity and try again

If you found solution is helpful plz mark as solved

Cheers


Getting this error now

Its not working after removing the extra quote

Hey @Anurita_Mishra

I can see still extra quotes are there pls use my same expreesion.

if not work then try like below:

’ In Assign activity
psCommand = “& ‘C:\Program Files\Google\Chrome\Application\chrome.exe’ --lang=en --accept-lang-en --incognito”

’ In Invoke PowerShell
CommandText = psCommand
TypeArgument = System.String

OR
Methode3:
Process.Start(“C:\Program Files\Google\Chrome\Application\chrome.exe”, “–lang=en --accept-lang-en --incognito”)

happy automation

Just use an assign , this executes without VB expression errors.

psCommand = “& ‘C:\Program Files\Google\Chrome\Application\chrome.exe’ --lang=en --accept-lang=en --incognito”

CommandText: psCommand

You dont need to open Chrome via Powershell.

You can do it via the Application scope and pass arguments to that. The browser scope you have after has a toggle to open in Incognito and you can pass the language via input arguments there also. Powershell is an extra complication you don’t need.

Just do it using use application/browser. Just check icogito window

If you really want to use power shell.
Make sure you are using the correct path.

  1. Right click on the chrome shortcut and select Open file location
  2. Right click on that chrome shortcut as its still not the correct path and select Open File Location
  3. Check if its this

“C:\Program Files\Google\Chrome\Application\chrome.exe”
or
“C:\Program Files (x86)\Google\Chrome\Application\chrome.exe”

Then your command should be:

& “C:\Program Files\Google\Chrome\Application\chrome.exe” --lang=en --accept-lang=en --incognito
or
& “C:\Program Files (x86)\Google\Chrome\Application\chrome.exe” --lang=en --accept-lang=en --incognito

Then encapsulate in “” to make UiPath happy.
So it will be:

“& “C:\Program Files\Google\Chrome\Application\chrome.exe” --lang=en --accept-lang=en --incognito”
or
“& “C:\Program Files (x86)\Google\Chrome\Application\chrome.exe” --lang=en --accept-lang=en --incognito”