Question

Locked

how to call a .bat file in vb?

By yatinchitre ·
i want to call batch file in vb plz help me
i m a new to dis

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

ok, two things.

by Slayer_ In reply to how to call a .bat file i ...

First, what version of VB? (VBScript, VBA, VB5/6, VB.net)

Second, have you tried googling this first before asking?

Collapse -

Same way as you do any other sort of file

by Tony Hopkinson In reply to how to call a .bat file i ...

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

Collapse -

you can do endless stuff this way

by Dr Dij In reply to how to call a .bat file i ...

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.

Collapse -

Check out this link

by Jacky Howe In reply to how to call a .bat file i ...

Set oShell = CreateObject("WScript.Shell")
oShell.Run "c:\32.bat"

http://www.computerperformance.co.uk/ezine/ezine26.htm

<i>Keep us informed as to your progress if you require further assistance.</i>
<HR>
<i>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 <b>Helpful</b> so that others may benefit from the outcome. </i> :-bd

Back to Software Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums