Solved

file run

Posted on 2008-09-30
14
153 Views
Last Modified: 2010-04-30
vbs code that run file after every 10 milli second automatically.
0
Comment
Question by:ankur3020
  • 7
  • 7
14 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 50 total points
ID: 22607521
An endless loop in the making...
Dim objShell : Set objShell = CreateObject("Wscript.Shell")
 
RunIt()
 
Sub RunIt()
  Wscript.Sleep 10
  objShell.Run "command.exe"
  RunIt
End Sub

Open in new window

0
 

Author Comment

by:ankur3020
ID: 22607558
will this code run command.exe after every 10 milli second. ?

suppose i i make file name my.vbs. and i want this file should run after every 10 milli second, then what should be the amended code ? what i add in that file? please guide.
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 22607793
you only need to change command.exe to the full path and command of the file you want to run...
Presumably you're looking at crashing a computer though?  I'd advise to rethink what you're attempting.
0
ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

 

Author Comment

by:ankur3020
ID: 22610772
you means command.exe should be replaced by c:\sample\my.vbs, if c:\sample\ if path of file need to be run.

But if the file is on cd then what will be the path? as cd drive varies from system to system?
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 22610823
I'm not sure of your requirements.
If you want a script to rerun the same executable over and over, the above will work for you - regardless of what you call it or where you place it.

If on the other hand, you're looking at scheduling the script using AT scheduler, then you would need to remove the wscript.sleep 10 line, however I don't believe the scheduler will let you use increments less than a minute...
0
 

Author Comment

by:ankur3020
ID: 22614629
i checked your code, it is working fine if i call any exe. but can you tell me if i want to add above code to my vbs file so that i can run vbs file code after defined time gap. what will i write in place of objShell.Run "command.exe" . please specify if other changes required.
0
 
LVL 67

Assisted Solution

by:sirbounty
sirbounty earned 50 total points
ID: 22614653
objShell.Run "wscript c:\pathtofile\filename.vbs"

should do it...
0
 

Author Comment

by:ankur3020
ID: 22675546
thanks , u told me how to run exe or vbs files. but now my vbs file is ready and i want it should run itself  once i start. after specified time . so how to add code for this.
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 22677312
For 50 points, I believe this question has been answered as it was originally stated...
0
 

Author Comment

by:ankur3020
ID: 22679816
lets increase point to 125 .now can u tell me how to do the job? pls.
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 22679941
I don't understand what you're trying to do...
0
 

Author Comment

by:ankur3020
ID: 22680171
sir do not try to know, just tell the answer of simple question of mine. pls.
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 22680751
If you're not willing to give me an idea of what you're trying to accomplish, so that I don't waste my time chasing several different 'possible' solutions, I won't take the time try.

Your initial question has been answered.  The site has rules on asking multiple questions inside a single thread.

Plus I don't understand what more you want, so since I can't read your mind, and you're not willing to clarify, please close this question...

0
 

Author Closing Comment

by:ankur3020
ID: 31501638
thanks
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

773 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