Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Creating infinite loop in VBS

Posted on 2007-04-11
6
Medium Priority
?
7,626 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 2000 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
Technology Partners: 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Ever notice how you can't use a new drive in Windows without having Windows assigning a Disk Signature?  Ever have a signature collision problem (especially with Virtual Machines?)  This article is intended to help you understand what's going on and…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
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). …

610 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