I'm trying to launch a program using powershell that is located in c:\program files
PS C:\mydir> "c:\program files\node18\npm" run test
At line:1 char:31
+ "c:\program files\node18\npm" run test
+ ~~~
Unexpected token 'run' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken
When I try enclosing the entire command with quotation marks, he simply echoes the command back:
PS C:\mydir> "c:\program files\node18\npm run test"
c:\program files\node18\npm run test
Finally the solution suggested in Spaces cause split in path with PowerShell is not working for me:
PS c:mypath> & "c:\program files\node18\npm run test"
& : The term 'c:\program files\node18\npm run test' is not recognized as the name of a cmdlet, function, script file,
le program. Check the spelling of the name, or if a path was included, verify that the path is correct and
.
char:3
rogram files\node18\npm run test"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
egoryInfo : ObjectNotFound: (c:\program files\node18\npm run test:String) [], CommandNotFoundExcepti
lyQualifiedErrorId : CommandNotFoundException