Hide CMD after opening - cmd

Does anybody know how to hide a console window (cmd), by just typing something into the console (not usbing VBS, batch-file or whatever), just using the cmd?
Is there a way to minimize it but still be able to type something?
Also heard of a possibility to just move the window out of your monitors size, does this work and if yes how?

You can start it minimized with start /min or start a new cmd minimized and close the old cmd start /min && exit but you loose the focus, you can't type commands in the minimized cmd, you need to klick it and bring it to front. You could execute a bat file with your commands (to execute them "invisible") start /min cmd.exe /C mybat.bat && exit
For "windows+r" (run) you can use: cmd.exe /C "start /min cmd"

Related

Close a Window in Windows Command Prompt

Hey I've got a quick question,
I know that you can start applications minimized through the command prompt with something like:
start /min "" "C:\Windows\notepad.exe"
However is there a way to automatically close the window, now I don't mean kill the process/task. Just close the window. In notepads case this would work the same way as killing the process, but in something that will minimize to a system tray on a window close, like Skype, or Discord for example this wouldn't kill the process but instead just put the task away from sight.
Thanks
This is not possible in batch files alone, instead this script creates a temporary VBScript at %temp%\hidden.vbs and then passes arguments to it using wscript.exe
This script doesn't minimise it or send it to the system tray, it just hides it and is only visible in Task Manager
#echo off
(echo CreateObject^("Wscript.Shell"^).Run """" ^& WScript.Arguments^(0^) ^& """", 0, False) > "%temp%\hidden.vbs"
set launch=wscript.exe "%temp%\hidden.vbs"
%launch% notepad

Avoid cmd.exe start closing Windows terminal

I need to run a program of mine with a /realTime priority option. For that purpose I'm running on CMD:
cmd.exe /k start "MyProgram" /WAIT /RealTime "C:\Users\Me\bin\Release\MyProgram.exe" " option"
start will run the process MyProgram at the highest priority and when it finish however closes the window (the /WAIT parameter doesn't work in this case as it's not a matter of synchronizity). The /k parameter cannot catch in the same way the result of start command, as it closes itself. Do you know how can I use start command setting a priority without cmd closing my window terminal? Thanks a bunch.
Got it. The way to go is:
cmd /k start "C" /B /WAIT /RealTime "C:\Users\Me\MyProgram.exe" " option"
It's the only way I see to prevent start command closing windows. The /B param will run MyProgram in the same window, instead of opening a new one exlusively for the command. The cmd /k will do its work to prevent start closing the window when the program has finished.
Given the one line of batch, what should happen is that the program starts and your batch windows should remain open until your program exits.
Are you expecting /wait to wait after myprogram has terminated?
If so, try
start "MyProgram" /WAIT /RealTime "C:\Users\Me\bin\Release\MyProgram.exe" " option"
pause

.bat start program and force minimized

I have a tiny .bat file that opens 3 programs
One of them should be started minimized:
START /MIN C:\PROGRA~2\HOBBYI~1\VLCSET~1\VLCSET~1.exe
This program, however, ignores the /MIN tag and it cannot be minimized manually either (only has the exit symbol and ignores win+m).
How can I force it to either hide or run minimized?
I am using win 10
If the program doesn't allow minimization, you can't minimize it. There might be some ugly hacks to work around this, but that's usually the point where you should ask yourself whether you really want to use a program that doesn't seem to fit your requirements.
You have to use the following:
"cmd.exe /c start /min your_file.bat"
If you with the cmd window to close itself once the .bat file has completed, use this:
"cmd.exe /c start /min your_file.bat ^& exit"

Windows 8.1 unable to run batch file without command prompt flashing

I have scheduled a task to run a batch file, and currently every time the task executes, there is a command prompt box that flashes. This is very undesirable. The node.js command prompt window executes minimized correctly, it is the windows command prompt that flashes.
Here is the action that the scheduled task runs:
cmd /min /c "C:\Users\computeruser\Building Intelligence\javadobe\runCheck.bat"
and here is the contents of the batch file, (probably unnecessary to show, but I was originally trying to run these commands straight from the task scheduler. Putting them in this batch file instead has got me closest to what I actually want to happen: run a javascript file with node.js minimized):
cd "C:\Program Files (x86)\BuildingIntelligence\javadobe\" & START /MIN node index.js /exit
A list of the commands I've tried:
cmd.exe /c start /min "C:\Users\computeruser\Building Intelligence\javadobe\runCheck.bat"
cmd.exe /c start /min "C:\Users\computeruser\Building Intelligence\javadobe\runCheck.bat" & /exit
%comspec% /c start "" /min "C:\Users\computeruser\Building Intelligence\javadobe\runCheck.bat"
all of these commands leave the command prompt box open, not closing it but minimizing it after it opens. There is also a notification that says "not enough storage is available to process this command".
I need to run this task with the highest privileges, and while it needs to be invisible most of the time, it needs to be able to show a dialog box occasionally when the task is run.
Thanks in advance for any help!
Basically, if what you have tried doesn't work, you're going to need a third party tool. NirCMD should do it and it's freeware.
NirCMD exec hide "C:\Users\computeruser\Building Intelligence\javadobe\runCheck.bat"
At the bottom of this page there is a link for the download. This page covers what the tool is capable of.

how to minimize the command prompt when running a batch script?

anybody know how to minimize the command prompt when running a batch script in Windows 3.11?
in Windows XP, there have a command
start /min start.bat
to minimize the cmd prompt, is it have similiar command in MSDos 6.22?
This little batch code should do what you need.
http://zoombody.com/articles/run-a-batch-script-minimized
The relevant code then needs to be placed at the top of your script:
if not "%minimized%"=="" goto :minimized
set minimized=true
start /min cmd /C "%~dpnx0"
goto :EOF
:minimized
rem Anything after here will run in a minimized window
Here is more information about "%~dpnx0".
There isn't a command that you can use from a DOS prompt, however you can create a PIF file that points to your batch file, in which you can set the default window position (including minimized).
...I think. It's been a couple of decades.
How to minimize the current command prompt:
Purpose:
Close a command prompt after execution.
Open a new command prompt using the same path.
First open command prompt :
Hold down the [Windows] + [R] keys.
Go to this location:
C:\>cd Users\Admin\Desktop
Next excute:
C:\Users\Admin\Desktop>start /min && exit
Results:
A new minimized command prompt should open with the same path.
Alternatively:
Create a script named minimize.bat and type start /min && exit into the script and place it in your system32 folder. In order to have the ability to access it via the command prompt.
Windows 10 makes it very easy to start minimized. Simply create a shortcut and click properties. On the shortcut tab half way down is the "Run:" option witch lets you select how you want the command line window to start up. Just select minimized and your command window will remain minimized from the onset.
Windows10 properties window of a shortcut
Use WinExec to start your batch file and pass SW_SHOWMINIMIZED for the second parameter.
See also, How do I run a batch file with WinExec?

Resources