Member Avatar

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 :-/

Recommended Answers

Is command a textbox? Then try:

Shell(command.Text)

Without the double quotes.

Jump to Post

You probably forgot the path.

Jump to Post

All 5 Replies

Is command a textbox? Then try:

Shell(command.Text)

Without the double quotes.

Member Avatar

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

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

Made it anyways...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.