Solved

file run

Posted on 2008-09-30
14
157 Views
Last Modified: 2010-04-30
vbs code that run file after every 10 milli second automatically.
0
Comment
Question by:ankur3020
[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
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

729 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