tags:

views:

79

answers:

4
+1  Q: 

GUI Using Batch

When you try to do things using Windows Batch, you normally think on a Text Program, but I want to know if there is anyway to use instead of those string inputs at the command window, put on a TextField, and that the messages get displayed at a MsgBox. Also, if it's possible to hide the console window.

Don't matter if VBScript is needed, but only Batch should be better for me

A: 

There was GUI programs in DOS, remember that all windows version before 98 SE all started from DOS ( Not NT kernal based os off course, like we are all using now).

Assuming your not planning on writing a DOS app ( qbasic can do this i think). You can off course do a few tings.

DOS based menus, sort of easy UI where you would use number on your keyboard to navigate. If your not going for any of the above solutions, you can use a batch file to Start a Windows applciation.

There are also solutions where you could either start a application, or even use a system compiler to compile the code for the app you want. You can off course start the DOS window hidden, that kind of depends on where you start it from.

EKS
I need to use Batch, and it will run on a 32 bits Windows
Nathan Campos
What ever os you run it on DOS/Command shell is gonna be 16bit.
EKS
@EKS That's not true. `CMD.EXE` is 32-bit.
aphoria
Yeah, there are command programs that are 32 bits. Try to run them on 16 bits, they will never run.
Nathan Campos
Yes sry i was incorrect. Seems command shell no longer is 16bit.
EKS
A: 

You might want to take a look at AutoIt, you are able to create executables (with no dependencies) which will not open a console window. You can create GUI windows or just popup plain input or message boxes.

Most of the automation programs/scripts I build are in AutoIt.

SiliconChaos
I want to build my code, not use a application to build it for me
Nathan Campos
A: 

I think the closest that you're going to get with just Windows batch is using the SET /P variable=[promptString] command to prompt the user for input.

I once worked in an area where there were a lot of batch scripts that needed lots of arguments passed to them, that the users (non-technical) found awkward and confusing (and justifiably so). I created a GUI "wrapper" for these scripts that would parse each batch file and create a dynamic GUI for its arguments. The user could click a button to run the script; I would shell out to an invisible console, capture the output, and display it in a scrollable textbox. The user could then copy the result to the clipboard or save it to a text file. Perhaps you can do something like that for your scripts?

Patrick Cuff
A: 

Without additional tools you're unlikely to succeed with batch files alone. VBScript makes displaying an input box or a message box trivial as you noted. From a batch file you can only show a message box and that one's not even pretty.

You can certainly hide the console window (ShowWindow will do that), but again, you'll need another program to do it for you. Also it's not nice to hide it if started from a shell already – let the batch file terminate prematurely and you have a console window hidden somewhere.

I'd suggest you use VBScript which runs on almost as many machines as pure batch files and is orders of magnitude better suited for what you want here.

Joey