Solved

file run

Posted on 2008-09-30
14
158 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…
Suggested Courses
Course of the Month4 days, 16 hours left to enroll

635 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