开发者

What's the equivalent of the bash in windows batch?

开发者 https://www.devze.com 2022-12-23 22:36 出处:网络
while [1 = 1] do eje开发者_Python百科ct sleep 1 eject -t sleep 1 done And this is said to be the same: watch -n 1 eject -T
while [1 = 1]
do
eje开发者_Python百科ct
sleep 1

eject -t
sleep 1
done

And this is said to be the same:

watch -n 1 eject -T

What does it do?What's the equivalent in batch?


you can try this 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

save as eject.vbs run it as

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

精彩评论

暂无评论...
验证码 换一张
取 消