Solved

Creating infinite loop in VBS

Posted on 2007-04-11
6
5,301 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
  • 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
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…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now