Solved

file run

Posted on 2008-09-30
14
154 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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 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…

861 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