Solved

Creating infinite loop in VBS

Posted on 2007-04-11
6
6,273 Views
Last Modified: 2016-09-22
What might be the most compact instruction I could use to cause an infinite loop in vbs?
Thanks!
JohnD
0
Comment
Question by:johndarby
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 35

Expert Comment

by:mvidas
ID: 18890733
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
 
LVL 1

Author Comment

by:johndarby
ID: 18890906
Thanks Matt!
Is there a way to determine when the script engine has timed out with the script above?
0
 
LVL 35

Accepted Solution

by:
mvidas earned 500 total points
ID: 18890997
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:johndarby
ID: 18891408
Thanks Matt; that's great!
0
 
LVL 35

Expert Comment

by:mvidas
ID: 18891448
Glad to help!
0
 

Expert Comment

by:Lokesh Natarajan
ID: 41810404
It is not working out for me. When I tried to compile the code above,it become not responding.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a little timesaver I have been using for setting up Microsoft Small Business Server (SBS) in the simplest possible way. It may not be appropriate for every customer. However, when you get a situation where the person who owns the server is i…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question