Member Avatar

DyO1

Hello everyone, I'm a making a BAT file creator and I can't find a way to add a 'Test' feature (open without saving)
This is the code I tried using:

    Shell("command.Text")

*Doesn't shell start DOS?
command.text=that's where users wrtie a code

Can someone give me a working code on how to make dos run commands for a bat file without opening it?
llike writing and runing a command and something like that :-/

Is command a textbox? Then try:

Shell(command.Text)

Without the double quotes.

Member Avatar

DyO1

Yes, command is what the text box name's is!
Tried that code and it says File Not Found, same with the double quotes.

You probably forgot the path.

Member Avatar

DyO1

Here's a WORKING code:

       System.IO.Directory.CreateDirectory("C:\BATman Temp\")
        Dim writer As New IO.StreamWriter("C:\BATman Temp\testfile.bat")
        writer.Write(command.Text) 
        writer.Close() 
        System.Diagnostics.Process.Start("C:\BATman Temp\testfile.bat")

'C:\BATman Temp\ is the temp directory
'testfile.bat is the temp file name
'after saving it executes with System.Diagnostics.Process.Start
Member Avatar

DyO1

Made it anyways...