You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PowerShell中Start-Process调用AzCopy无效果,手动执行正常求解决

解决PowerShell中Start-Process调用AzCopy无下载动作的问题

问题出在你给Start-Process的ArgumentList参数上——你手动给URL和本地路径加了单引号,但这在PowerShell的参数传递逻辑里是错误的。

手动在控制台执行AzCopy命令时,单引号是用来让PowerShell不解析URL里的特殊字符(比如SAS令牌中的&、?),但Start-Process处理参数的方式不同:如果把带单引号的字符串传给它,单引号会被当成参数的一部分直接传递给AzCopy,导致AzCopy无法正确识别源地址和目标路径,所以进程会直接退出,没有任何下载动作。

修正后的脚本(推荐用数组形式传递参数,避免引号问题)

Start-Process `
    -FilePath "C:\temp\AzCopy\azcopy.exe" `
    -ArgumentList @(
        "cp",
        "https://<storageaccountname>.blob.core.windows.net/<blobcontainername>/Languages?<SASTOKEN>",
        "C:\Temp",
        "--recursive"
    ) `
    -Wait `
    -Passthru

另一种修正方式(字符串形式,去掉多余单引号)

Start-Process `
    -FilePath "C:\temp\AzCopy\azcopy.exe" `
    -ArgumentList "cp https://<storageaccountname>.blob.core.windows.net/<blobcontainername>/Languages?<SASTOKEN> C:\Temp --recursive" `
    -Wait `
    -Passthru

用数组形式传递参数是更稳妥的方式,PowerShell会自动把每个数组元素作为独立参数传给AzCopy,完全避免引号解析的问题。

内容的提问来源于stack exchange,提问作者Michael

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.03 20:10:28