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

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.

Related

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.

Running an .exe from within a .bat

I realize this might be a very basic question but I am slightly new to working with batch.
I am trying to use delprof to delete user profiles off multiple remote computers. I have Delprof.exe saved and can run it from a cmd window to put in different required arguments such as "/p /d:30". I can have my batch file run the application using the start command but it quickly closes the window.
I need to have delprof run from the batch but be interactive so it can prompt me with what profiles it has found and if I want to delete them. Basically Im trying to use this so I dont need to enter the arguments every time. I want it to be one click on the batch file and it will pop up with the profiles found and ask me which ones it should delete.
You are not clear on exactly what you want. But omitting start will probably do what you want. Which is run delprof as if you typed it at command line.
If not see the set /p command.
set /p remote=Enter Computer Name
delprof /c:\\%remote%

I want to prevent a window from opening when an application launches

I have a program the opens a window, reads a config file, then closes the window a fraction of a second later, then continues running in background. I want to be able to start this program one way or another without the window appearing in the first place.
Is there a way for me to launch the program (preferably on PC startup) but suppress any windows it creates?
I do not have the source code for the program in question. In that regard I am an end-user.
use a vbs script to open it:
set obj = createobject("wscript.shell")
obj.run "prog.exe",0,false
call that prog.vbs or whatever, and put it in:
"%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\startup"

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

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

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.

Resources