这个powershell脚本有什么问题? [英] What wrong is this powershell script?

查看:99
本文介绍了这个powershell脚本有什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

参考以下脚本,它不应该打开Excel文件"ABC.xls"。星期六晚上11点26分,但是当我运行时它会打开。

Referring to following script, it should not open Excel file "ABC.xls" at 11:26 PM on Saturday, but it opens when I run it.

有没有人对错误提出任何建议?

提前致谢任何建议

Does anyone have any suggestions on what wrong it is?
Thanks in advance for any suggestions

============================= ========================================

=====================================================================

$ today =获取日期



#检查工作日为
#IF($ today.DayOfWeek -ne" Saturday" - AND $ today.DayOfWeek -ne"Sunday"))
#{

    #Write-Host"Valid Day"&
    #Check我们在几小时内就可以了...
    #if(($ today.Hour -eq 7 -AND $ today.Minute -gt 30)-OR $ today.Hour -gt 7)

    #{

$
        #Write-Host"启动后"
$
        #if($ today.Hour -lt 23)

        #{

         start-process" C:\Program Files \ Microsoft Office \ OFFFFICE11 \EXCEL.EXE" 'C:\ABC.xls'
$
        #}



    #}

#}

$today = Get-Date

#Check it's a weekday
#IF ($today.DayOfWeek -ne "Saturday" -AND $today.DayOfWeek -ne "Sunday")
#{
    #Write-Host "Valid Day"
    #Check we're within the hours
    #if (($today.Hour -eq 7 -AND $today.Minute -gt 30) -OR $today.Hour -gt 7)
    #{

        #Write-Host "After start"
        #if ($today.Hour -lt 23)
        #{
        start-process "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" 'C:\ABC.xls'
        #}

    #}
#}

提前感谢任何建议

推荐答案

您评论所有行除了正常吗"开始过程"命令用"#"?
Is it normal that you comment all lines except the "start-process" command with "#"?


这篇关于这个powershell脚本有什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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