Powershell调用cmd.exe命令,例如复制/b [英] Powershell call cmd.exe command like copy /b

查看:95
本文介绍了Powershell调用cmd.exe命令,例如复制/b的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了 Powershell中的快速和简单二进制连接文件

我对上面的答案不感兴趣,我对下面的语法有什么问题感兴趣:

I'm not interested by the answer above I'm interested about what's wrong with syntax below :

当我调用 cmd.exe 命令(例如 copy/b :

function join-file {
   copy /b $($args[0])+$($args[1]) $($args[2])
}

我收到错误消息 Copy-Item:找不到位置参数

推荐答案

正如错误所暗示的, copy 实际上只是 Copy-Item 的别名,它确实没有/b 参数.您可以调用cmd来使用其复制命令.

As the error alludes to, copy is actually just an alias for Copy-Item and it does not have a /b parameter. You can call cmd to use its copy command.

function join-file {
   cmd /c copy /b $($args[0])+$($args[1]) $($args[2])
}

这篇关于Powershell调用cmd.exe命令,例如复制/b的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆