如何在一定量的循环后启动批处理文件等文件?

时间:2013-11-15 05:33:12

标签: vbscript

这是我的剧本

Set oWMP = CreateObject("WMPlayer.OCX.7")
Set colCDROMs = oWMP.cdromCollection
wscript.sleep 1800000
do
    if colCDROMs.Count >=1 then
        For i = 0 to colCDROMs.Count - 1
            colCDROMs.Item(i).Eject
        Next
        For i = 0 to colCDROMs.Count - 1
            colCDROMs.Item(i).Eject
        Next
    End if
    wscript.sleep 600000
loop

我打算在启动30分钟后和每隔十分钟后弹出CD托盘,我想知道的是如何在说出3个循环之后打开某个文本文件?

1 个答案:

答案 0 :(得分:0)

它的价值......每次CD抽屉打开后,每次打开文本文件file。如果你想要的话,你可以把数量设定为零......

Set oWMP = CreateObject("WMPlayer.OCX.7")
Set colCDROMs = oWMP.cdromCollection
wscript.sleep 1800000
count = 0
do
    if colCDROMs.Count >=1 then
        count = count + 1
        For i = 0 to colCDROMs.Count - 1
            colCDROMs.Item(i).Eject
        Next
        For i = 0 to colCDROMs.Count - 1
            colCDROMs.Item(i).Eject
        Next
    End if
    If count >= 3 Then
      file = "c:\path\to\my\file.txt"
      CreateObject("WScript.Shell").Run "notepad.exe """ & file & """"
    end if
    wscript.sleep 600000
loop