Creating infinite loop in VBS

What might be the most compact instruction I could use to cause an infinite loop in vbs?
Thanks!
JohnD
LVL 1
John DarbyPMAsked:
Who is Participating?
 
mvidasConnect With a Mentor Commented:
By default there is no timeout value, so it won't actually time out using just the code above.  You can set the number of seconds before timeout using     wscript.timeout=numberofseconds    but there is nothing notifying you when that is reached.

You can see what I mean by opening your task manager and sorting the processes in reverse alphabetical order. when this starts running you'll see wscript.exe in the list, and after it reaches the timeout value (10 seconds) it will quit. I'm echoing the timeout value so you can see it has the default value of 0 (no timeout) then you can see the change implemented:

wscript.echo wscript.timeout
wscript.timeout = 10
wscript.echo wscript.timeout
For i = 1 to 10
 i = i - 1
Next

Matt
0
 
mvidasCommented:
Hi John,

Not sure why you want to do this, but what about just:

For i = 1 to 10
 i = i - 1
Next

Matt
0
 
John DarbyPMAuthor Commented:
Thanks Matt!
Is there a way to determine when the script engine has timed out with the script above?
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
John DarbyPMAuthor Commented:
Thanks Matt; that's great!
0
 
mvidasCommented:
Glad to help!
0
 
Lokesh NatarajanCommented:
It is not working out for me. When I tried to compile the code above,it become not responding.
0
All Courses

From novice to tech pro — start learning today.