我想使用"运行"命令在一行中运行这个程序:
powershell -NoExit ; Get-ChildItem -Recurse -force -Include *.ost \\PcHostname\c$\users -ErrorAction "SilentlyContinue" | ls | Select-Object Name, @{Name="GigaBytes";Expression={$_.Length / 1GB}}
但是我遇到了以下错误:
GigaBytes : The term 'GigaBytes' 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:137
+ ... t Name, @{Name=GigaBytes;Expression={$_.Length / 1GB}}
+ ~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (GigaBytes:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
不需要在已启动的Powershell窗口中使用powershell -NoExit ;
,代码就可以运行。
有什么解决方法吗?