Skip to content

Instantly share code, notes, and snippets.

@taka2
Created May 20, 2011 07:52
Show Gist options
  • Save taka2/982518 to your computer and use it in GitHub Desktop.
Save taka2/982518 to your computer and use it in GitHub Desktop.
VBScriptでsleepソート
' test.vbs
Set wshell = CreateObject("WScript.Shell")
Set args = WScript.Arguments
For i=0 to args.Count - 1
wshell.Run "wscript test2.vbs " & args(i), 0, False
Next
'test2.vbs
Dim val
val = WScript.Arguments(0)
WScript.Sleep(val * 500)
WScript.Echo(val)
'実行
cscript test.vbs 5 2 1 4 3
'結果
メッセージボックスが1, 2, 3, 4, 5の順であがってくるはず。
(Sleepが短いとソートに成功しません。。)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment