如何在一行上在PowerShell中执行多个命令?在PowerShell中执行多个cmdlet
我试图解开该目录中的文件和输出他们的名字:
@"powershell get-childitem E:\\WRT\\Downloads\\TouchGesturesVisio -Recurse ^|select BaseName,Extension ^|unblock-file"
我需要能够做到这一点的一个独立的应用程序,但到目前为止,我只能得到一个小命令起作用。
当我从应用程序运行命令时,出现以下异常。
powershell get-childitem E:\WRT\Downloads\TouchGesturesVisio -Recurse ^|select B
aseName,Extension ^|unblock-file
Error unblock-file : The input object cannot be bound to any parameters for the
Error command either because the command does not take pipeline input or the inp
ut
Error and its properties do not match any of the parameters that take pipeline i
nput.
Error At line:1 char:88
Error + ... ame,Extension |unblock-file
Error + ~~~~~~~~~~~~
Error + CategoryInfo : InvalidArgument: (@{BaseName=ReadMe; Extensi
on=.
Error txt}:PSObject) [Unblock-File], ParameterBindingException
Error + FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Com
mand
Error s.UnblockFileCommand
Error
Error unblock-file : The input object cannot be bound to any parameters for the
Error command either because the command does not take pipeline input or the inp
ut
Error and its properties do not match any of the parameters that take pipeline i
nput.
Error At line:1 char:88
Error + ... ame,Extension |unblock-file
Error + ~~~~~~~~~~~~
Error + CategoryInfo : InvalidArgument: (@{BaseName=Touc...Extensio
n=.v
Error ss}:PSObject) [Unblock-File], ParameterBindingException
Error + FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Com
mand
Error s.UnblockFileCommand
Error
Error unblock-file : The input object cannot be bound to any parameters for the
Error command either because the command does not take pipeline input or the inp
ut
Error and its properties do not match any of the parameters that take pipeline i
nput.
Error At line:1 char:88
Error + ... ame,Extension |unblock-file
Error + ~~~~~~~~~~~~
Error + CategoryInfo : InvalidArgument: (@{BaseName=Touc...Extensio
n=.v
Error st}:PSObject) [Unblock-File], ParameterBindingException
Error + FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Com
mand
Error s.UnblockFileCommand
Error
我知道使用的选项,但遗憾的是它不Windows 8.1工作。程序集依赖关系与Windows 8.1混淆。
什么应用?你还没有尝试过我的回答的错误 – Raf