psutils icon indicating copy to clipboard operation
psutils copied to clipboard

[sudo] Command is incorrectly parsed when calling a .NET function

Open brunovieira97 opened this issue 5 years ago • 0 comments

When calling a .NET function, sudo will incorrectly pass the command to the administrator instance, removing some characters.

Steps to reproduce:

PS> sudo [Environment]::SetEnvironmentVariable('Path', $value, 'Machine')

ParserError:
Line |
   1 |  [Environment]::SetEnvironmentVariable Path, 'C:\Users\bruno\desktop\D …
     |                                        ~~~~
     | Unexpected token 'Path' in expression or statement.

sudo removed the parenthesis, as well as the quotes on Path, causing the command to be syntactically incorrect.

brunovieira97 avatar Mar 07 '21 17:03 brunovieira97