How to prevent GUI (VB6) program from returning control when run from a command line? - user-interface

There is a VB6 application. It can be run with command line parameters to create some report in a text file.
The problem is that when started from a batch file, application returns control immediately, so the following commands start executing. I need these following commands to wait until the VB6 app finishes its work.
How to achieve that?

The Start command has a wait switch which does exactly what you want.
c:\start /w notepad

You could rewrite the VB6 program as a console application.

Related

Open another cmd script from a cmd script without opening a new window

I'm trying to open a command script, say command1.cmd, from command.cmd, but I want to do this without opening a new console window. I tried start command1.cmd, but it opens a new window. Please can someone tell me how to do this.
Use call or if you're not need to return back to the first script just call the second script directly by its name.
Calls one batch program from another.
CALL [drive:][path]filename [batch-parameters]
batch-parameters Specifies any command-line information required
by the
batch program.

Stop running VBScript

I have a simple VBScript, which executes a batch file in the background. It starts correctly and it's working, but I can't stop it.
I already checked all of these answers, but I have no cscript.exe and no wscript.exe running
Any ideas?
You could try adding an "exit" statement at the end of your batch as long as you don't need to visually see the results (you could just write them to a text file). Just saying, in case you're experiencing this problem in the future.

How to close cmd after LabVIEW code executes

When I am running batch file through LabVIEW by using System Exec.vi, two cmd windows are appearing. The second one executes command of the batch file and closes after that, while the first one doesn't close. I have tried to use this solution, but it doesn't work. Is there any way to close that first cmd ?
P.S. If I run batch file not through LabVIEW, but just by double clicking on it, two cmd windows close after execution
It's hard to tell, but I think you've misunderstood the directions given at that link. The batch file should contain the executable and its options, but you just pass the batch file to the System Exec VI. I'm guessing what's happening here is the batch file is getting called twice, and some process that the first call depends on is getting hijacked by the second call, so that when the process ends, the second call gets notified and stops itself, but the first call is left hanging. Or something like that.

how do i get console to notify me when it is finished running a script

I am using nant, but this can apply to any thing, I just want to know if there is a way to set windows cmd or console2 or some kind of shell to give me a popup or make a noise when it is "finished" (i.e. when it is waiting and the screen says >C:\User\Random_FILE_PATH>_)
I'm using windows 7.
Valentine
sorry, to clarify, I am not running a script that I created, this is just when running anything in the console. I would like it to be that anytime my console is waiting for me it creates a pop up or a noise. This would ideally be some kind of setting
You may open a message box in the end of your batch file, using WSH with a simple VBScript or JScript. See Show a popup/message box from a Windows batch file for an example.
c:\> my_command & mshta.exe vbscript:Execute("msgbox ""finished"",0,""finished"":close")
this here uses conditional execution - when my_command is finished the mshta.exe will be executed with arguments in the brackets.As the parameter passing here is not so easy the string given to msgbox will not be displayed.
you can add a beep to your prompt:
set prompt=%prompt%^G
Don't type ^G. To get it, keep your alt-key pressed while entering 0 0 7 on your numeric keyboard.

My Ruby files don't run correctly

When i click on a .rb file to run it a CMD window pops up for a brief second and then closes again. This is probably a really nooby question thats easily fixed but i've looked everywhere for help. But like i said it pops up for a brief second and i THINK while its up its executing the code but when the codes done it closes so i don't know if i'm making mistakes in code or other important things like that.
Run the program through the command prompt (CMD), that way you can see the result, otherwise the window closes when the program exits.
Alternatively, you can prevent the program from exiting by putting some sort of blocking instruction at the end of the script, such that the program waits for user input before exiting.
Press Windows_Key+R and then type CMD. Browse to the location of the file and then type ruby your_ruby_file.rb. The program is running, but Windows automatically closes the window upon completion of the command.
To get Windows to run your *.rb files through Ruby when you click on them in the UI, you have to associate the .rb extension with the ruby.exe executable. Such an association is called a "Windows File Association." Here's a Microsoft Knowledge Base article that'll tell you how to create such a thing.
http://support.microsoft.com/kb/307859

Resources