【问题标题】:What's the equivalent of the bash in windows batch?Windows批处理中的bash相当于什么?
【发布时间】:2010-03-25 10:01:04
【问题描述】:
while [1 = 1]
do
eject
sleep 1

eject -t
sleep 1
done

据说是一样的:

watch -n 1 eject -T

它有什么作用?批量相当于什么?

【问题讨论】:

    标签: bash syntax batch-file


    【解决方案1】:

    你可以试试这个 vbscript

    Const CDROM = 4
    Set objFS=CreateObject("Scripting.FileSystemObject")
    Set shell = CreateObject("Shell.Application")
    For Each drives in objFS.Drives
      If drives.DriveType = CDROM Then
        cd=drives.DriveLetter & ":\"    
        'Eject           
      End If
    Next
    Do
     shell.Namespace(17).ParseName(cd).InvokeVerb("E&ject") 
     WScript.Sleep 1000 'in ms
    Loop While 1=1
    

    另存为eject.vbs运行它

    c:\test> cscript //nologo eject.vbs
    

    【讨论】:

    • 这个可怕的代码会“点击”右键菜单中的弹出项,如果你的操作系统不是英文的,它会失败!也可以调用带有“内部”名称的动词,但不确定这些名称是否也是特定于语言的。
    • 如果它像你说的那样“可怕”,你为什么不提供解决方案。至少我是想帮忙,但你只会批评。
    猜你喜欢
    • 2016-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-20
    • 2012-01-19
    • 2013-03-11
    • 1970-01-01
    相关资源
    最近更新 更多