ok i want to run a bat file in vb? but how?
Printable View
ok i want to run a bat file in vb? but how?
Just Shell it:
Shell "c:\mybatchfile.bat"
humm... i mean like i have a window that is like commad prompt so i can see it running
Hmmm... That's all you really need - if you would just try typing you'd see a bunch of consts: ;)
Shell "c:\mybatchfile.bat", vbNormalFocus
Do you mean something like this?
no i want to make text1 show what is happening in the cmd window
The link to the code i gave shows exactly what you're after, but with one difference, that it's now showing what's happening in the cmd window, but by creating proccess and displaying output results ;)Quote:
Originally Posted by Gunner54
that code seems strange... i dont know what i need
were do i put my bat file dir
You don't need to use the batch file. Type the proccess and click a button - it will show you the output - usage is written in the code.
a button called... see i dont know what tools i need i didnt know i needed a button but whats the button called command1 or cmd1 i need a text box too whats that called....
do you need to see the text as the batch file runs, or could you get away with just seeing it after it gets done running?
if you only need it after the fact, it is really easy to get that text.
just add a ">" to your batch file command line, and specify a textfile name. the output that usually goes to the screen will be redirected to the text file. example:
'saves your ipconfiguration to textfile - "c:\ip.txt"
shell ("cmd.exe /c ipconfig > c:\ip.txt")
once it a text file, you can easily load it intoa textbox. examples abound.
good luck!