gpt4 book ai didi

windows - Copy-Item 命令在 Powershell 命令行中有效,但在 bat 文件中无效

转载 作者:可可西里 更新时间:2023-11-01 11:27:21 26 4
gpt4 key购买 nike

尝试使用 Copy-Item 命令将文件从一个文件夹复制到另一个文件夹。以下命令在 powershell 命令行中运行,但在 *.bat 文件中运行时抛出错误:

Copy-Item C:\script\* D:\

它抛出以下错误:

'Copy-Item' is not recognized as an internal or external command, operable program or batch file.

最佳答案

您不能直接批量运行 PowerShell cmdlet,您必须调用 powershell.exe 并将命令传递给它:

powershell -Command "Copy-Item C:\script* D:\"

关于windows - Copy-Item 命令在 Powershell 命令行中有效,但在 bat 文件中无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31826418/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com