Windows has a path length limit of 260 characters a workaround for this is to use a \\?\ prefix. Such a prefix works when using a regular PowerShell however using it in UiPath’s Invoke Power Shell activity it doesn’t seemed to be recognized as seen below:
Hello @MarekBruna, thanks for writing to us. While I cannot confirm technically what is the actual implementation of UiPath Powershell activity, I can suggest you a workaround that worked personally for me. Instead of using the Powershell activity directly to execute your command, I did the following:
Created a powershell script using the Powershell command window and save it as .ps1 somewhere in computer.
Used a read text file activity in Studio to take my script saved from computer and output it as a variable using the properties panel.
Used Invoke Powershell Script activity in Studio and put the variable name assigned previously to take my script.
(Optional) In order to check my result, I used a Write Line activity to check my final output (in my case, I only needed the first row, so I used [variablename].ElementAt(0).ToString)
While I am aware this is not ideal, I also raised this issue to the team who is handling this to make it more clear on usability.
Hello Marian, I’m aware of that workaround however I’m not allowed to make such changes to the environment where that script is supposed to run.
Nonetheless here is I believe a valid reason a particular user gave me for this issue, it seems to be caused by an incompatible .NET framework version, see quote below:
In VS test project 4.6.1, I’m getting two errors “Illegal characters in path”, just like in UiPath (Studio 2021.10.5, UiPath.System.Activities 21.10.4). Once switched to 4.7.2, I’m getting a good boolean true on any valid path beginning with "\?".
As such it seems that it is UiPath itself who needs to tackle this issue.
What do you mean by WIndows project? According to the quote above that person tried it in Visual Studio project using 4.6.1 .NET version and was seeing the same behaviour that can be spotted in UiPath, this would mean that the Invoke PowerShell activity should be re-developed by UiPath using 4.7.2+ version of .NET