How to Run Batch Files?

Hey guys i don't know much about *.BAT files.. but i wud like to know how to execute them?
suppose if i jus write a single command in a batch file like "shutdown -s -t 5" then how to execute it automatically?
and can we run batch files through Visual Basic Applications?
 
Create a batch file, put it somewhere and create a scheduled task to execute it at the time you want. Simple!

You can execute batch/COM files the same way as EXE files.
 
i dont know why u need VB for this ..

double-clicking bat files executes them jus like exe s..

haev the batch file saved in ur desktop.

easier than openin the start menu n the conventional way :bleh:
 
thanks checksum

@v1gensh i wanted to know about vb cos i jus thought that if i want to make a button in a form which can shutdown the pc.. how shld i do it.. so i jus thought of executing that batch file[containing the shutdown command] after clicking on the button.. :)
 
if you just want to shutdown (and not experimenting on VB) you can use a shortcut to shut down a system.

Create a shortcut on the desktop with
Code:
shutdown -s

in the target field. That should do it.

You can just type it in the run box to test if it works.
 
ya that i know.. i created a batch file wid the command shutdown -s -t 5 and then i wanted to execute it when the user clicks on the "Shutdown" button in the VB application..

The aim of the App is not only to create a shutdown button... it can be anything .. i jus wanted to know if we can execute bat files thru vb... it can b very helpful.. :p
 
hey i found it..

its easier than i though :p

for example
Code:
Private Sub Command1_Click()

Dim t

t = Shell("E:\Visual Basic\shut.bat", 1)

End Sub

this code will execute the batch file "shut.bat" :)
 
Kumar said:
Create a batch file, put it somewhere and create a scheduled task to execute it at the time you want. Simple!

You can execute batch/COM files the same way as EXE files.
how to create a scheduled task..... like i want to shutdown the system at 7:55 in the morning every day.....

guessed it right i am a BSNL borad-band user, who download movies and sometime i don wake up at 8 in the morning to shut it down.... faced a lotta bandwidth problems :D
so need help...... and yeah i am n00b :)
 
Namic said:
how to create a scheduled task..... like i want to shutdown the system at 7:55 in the morning every day.....

guessed it right i am a BSNL borad-band user, who download movies and sometime i don wake up at 8 in the morning to shut it down.... faced a lotta bandwidth problems :D
so need help...... and yeah i am n00b :)

shutdown -s, write this in a notepad, save the file as shutdown.bat. Go to Start->Program Files->Accessories->System Tool->Scheduled task. Then add a new task, select the shutdown.bat file and configure the time when you want it to run.

Please dont ask how to create a new task and what will be the settings, if you cant configure that, then you ought to wake up before 8, :bleh:
 
@ Namik...

Her's your guide Doood !! :clap:

1) I guess you are a H500 user like me !

2) What we are gonna do is that your internet connection will start up at 2:05AM in the morning ( BSNL servers are 5 mins before time, moreover i dont want you to loose a single MB f urs :p ) and will automatically disconnect at 8:00 in the morning..!

3) Go to Start>Connect to>Show all connections. Right Click on your dataone connection and enter "Dataone" (without quotes) in the service name area and click on OK !

4) Go to your desktop and create a new Text Document with the following text:-

rasdial Dataone [Dataone username] [Dataone Password]

Save the file as Connect.bat !! This is a Batch file now which on executing would connect to your Dataone connctn !

5) Now create another Notepad text document on the desktop with the following data:-

rasdial Dataone /DISCONNECT

(Save it with the name disconnect.bat) !!.. now this one wud be used to disconnect your connection !)

6) Go to Start > Control Panel > Scheduled Tasks > Add Scheduled Task. Click next and browse the connect.bat file and schedule it to run always at 2:06 AM. Click on OK.

7) Create another scheduled task and now browse the Disconnect.bat file and schedule it to execute daily at 8:06AM.

8) Now as we have scheduled your connection, Now we gotta switch off your computer as well, coz u get up late :p

9) Now goto scheduled tasks and right click on the "Connect" file which must have shown up in the scheduled tasks folder now. And click on properties.
Now goto "Set password" and enter your XP account passwrd dere.. If you havnt created a passwrd fr ur XP a/c, create one now. THIS IS NECESSARY or else these taks wont work !!.. :)

10) Now create another batch file with shutdown -s code given in the earlier posts and save it as shutdown.bat and then schedult it to run the same way as we did with the connect and disconnect files. You may set the time to 8:07 AM..!

11) You're done ... Now before you go to sleep .. Switch on your computer.. Dont connect to the internet. Just open up utorrent and leave it minimized. with all downloads set to " FORCE DOWNLOAD".

12) Dats it !!.. That was quite exhaustive bt i was really excited to help you with this.. Hope that helps..!!!

Good luck,!

Do tell me in cae you face any kinda aprob.. You can reach me at akshaykapoor3@gmail.com
 
Back
Top