如何在一行上在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