Solved

file run

Posted on 2008-09-30
14
149 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
 

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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

707 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

20 Experts available now in Live!

Get 1:1 Help Now