【发布时间】:2014-07-26 13:04:54
【问题描述】:
以下脚本在 Powershell 中有效,但在任务计划程序中作为操作执行时无效:
Copy-Item -Path '\\dfs.com\Risk Manage\Daily_DB\Daily_DB.accdb' -Destination "\\dfs.com\Risk Manage\SharedReports\Database Backup 2014\Daily_DB_backup $(get-date -f yyyy-MM-dd).accdb"
请注意,我需要使用双引号才能将 $(get-date -f yyyy-MM-dd) 转换为时间戳。不适用于单引号。
任务计划程序错误消息:Copy-Item:找不到接受参数“Manage\SharedReports\Database”的位置参数。
总而言之,有谁知道如何在任务计划程序中执行包含带有空格和时间戳的路径的 Powershell 脚本?
非常感谢
【问题讨论】:
标签: powershell windows-7 scheduled-tasks