how to call a .bat file in vb?
i want to call batch file in vb plz help me
i m a new to dis
Software
i want to call batch file in vb plz help me
i m a new to dis
by yatinchitre Accepted solution
by slayer_ Accepted solution
First, what version of VB? (VBScript, VBA, VB5/6, VB.net)
Second, have you tried googling this first before asking?
by tony hopkinson Accepted solution
VB/VBScript with ShellExecute
VB.Net with the Process class
Google them for lots of examples.
What they do with a few trimmings is throw the file at the operating system. It will see the .bat extension look up the association and run it for you.
Chuck a txt file Notepad will launch (usually), a doc , Word...
HtHs
by dr dij Accepted solution
you can trigger anything that you can run by throwing a file at the operating system, as previous poster mentioned.
I would trigger .bat files that would FTP files from a customer's site to process. (I would generate the .bat file dynamically in VB before calling it as a text file).
The .bat file would call FTP via command line. FTP can use its own command file in the call so it runs without any prompts.
Then we would even un-PGP files, which would trigger the PGP program to decrypt via command line; you can have it either prompt for password or just decrypt automatically if the key is on that PC.
We would then have the .bat file call a $50,000 data scrubber with the address files, which has its own param files so happily chugs away via command line and completes its job.
Then we would call an email command line .exe file with params and email the results to 17 dift people (email addresses read from a text file), with an attached .xls the job created.
We'd sometimes also do outgoing FTP to send a results file back to customer. Sometimes via .ssh - secure shell instead of plain FTP or a custom web based secure upload prog.
Some or all of this can be done directly from VB individual calls without creating .bat files in your prog, but it seemed easier to just do it this way :)
You could do other stuff like call xxcopy to backup systems or disks alot quicker than windoze runs.
by rob miners Accepted solution
Set oShell = CreateObject("WScript.Shell")
oShell.Run "c:\32.bat"
http://www.computerperformance.co.uk/ezine/ezine26.htm
Keep us informed as to your progress if you require further assistance. ;) :D
If you think that any of the posts that have been made by all TechRepublic Members, have solved or contributed to solving the problem, please Mark them as Helpful so that others may benefit from the outcome. ;) :D :-bd
This discussion is closed to new replies.
Sort by Trending