$computer = gc env:computername
SchTasks /create /SC Daily /tn "Image Verification" /ST 18:00:00 /TR C:\bdr\ImageVerification\ImageVerification.exe /RU '$computer'\admin /RP password
基本上我需要在计划任务中提供计算机名称......
提前谢谢!
答案 0 :(得分:10)
单引号字符串不会在PowerShell中扩展变量。尝试双引号字符串,例如:
"$computer\admin"
答案 1 :(得分:-1)
使用命令'hostname'获取本地pc的名称。