小编Bha*_*thi的帖子

在 Powershell 中,在路径中输入空格时调用表达式不起作用

我有一个查询,例如当我尝试执行包含带空格的路径的表达式时,出现如下错误。

代码:

$path="E:\Test\My space\Log"
Invoke-Expression $path 

E:\Test\My: The term 'E:\test\My' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ E:\Test\My space\Log
+ ~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (E:\Test\My :String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
Run Code Online (Sandbox Code Playgroud)

你能帮我解决这个问题吗?

powershell cmdlet

5
推荐指数
1
解决办法
5668
查看次数

标签 统计

cmdlet ×1

powershell ×1