Hide CMD window after execute command line by the RUN - cmd

How to hide CMD/BAT (the black box) WITHOUT using Vbscript, I dont like using VBSCRIPT because it slows down application before it autorun. So if you have a code to put into batch or CMD to hide the CMD/Bat file WITHOUT using VBScrpit. please let me know.
thanks

This might help you:
Solution #1
Use the /min slash after START command when starting your bat-file. This will start it with a minimized window. Example:
START /min c:\mypath\mybatfile.bat
Solution #2
Create a shortcut to CMD.EXE. Open up Properties box of the shortcut.
In shortcut-tab change "run" to "minimized".
In the target address (path and name of CMD) append path and name of your bat-file.
If you now doubleclick the shortcut, it should run CMD minimized, with no window showing, which in turn should start your bat-file.

Related

START command only opens new window if .EXE is NOT already running

So my Batch file command goes as follows:
#ECHO OFF
SET link1=google.com
SET link2=google.com
SET link3=google.com
START /MAX vivaldi.exe %link1% %link2% %link3%
When I double click my .BAT file, it only opens a new vivaldi window if there isn't one currently running. If I already have a vivaldi window open it will simply just open links 1-3 in new tabs on top of the tabs I already have open(and maximize the window if it is not). I was under the impression that the START command should always open the .EXE in a new window unless the /B flag is set(which it is not)?
Replace your last line with:
START /MAX vivaldi.exe --user-data-dir=c:\temp %link1% %link2% %link3%
You could create a dedicated folder rather than use C:\temp, and specify the full path to that instead.
Inspiration for the use of --user-data-dir from https://superuser.com/a/457045/122072.

How to use "cmd" to bring up another "cmd" wiindow?

If I enter cmd, I enter the console window, but if I type cmd inside "cmd", it just start a sub shell of "cmd" inside it. My requirement is, in "cmd", I type one command, it brings up another windows "cmd" console.
How to do this?
Thanks
Using start cmd should do it!
You can even call a batch file the same way, changing 'cmd' to your batch filename.
If start cmd doesn't work. You can try start call cmd.
Just type the command as follows:
start
This will open a new command prompt.
Also
start cmd.exe
will do the same thing.
PS: The following method might also be helpful.
To open a command prompt in a particular directory in the file explorer, follow these steps:
Go to the required folder in the explorer
Click on the path toolbar. Path toolbar in an explorer window
Enter "cmd".command prompt opened at the cwd
There you go! A cmd prompt opens up in the current working directory.

open program minimized via command prompt

I have a windows 8.1 machine and I want to open a program with minimized window.
For a program like notepad, I just use the following command:
start /min "" "C:\Windows\notepad.exe"
and then a new notepad window starts in minimized mode.
The problem is that not all programs do this. When I want to start for instance MS Word in minimized mode I use:
start /min "" "C:\Program Files (x86)\Microsoft Office\Office12\WINWORD.EXE"
but then a new Word windows starts up in MAXIMIZED mode.
Is there a way to start it minimized?
I tried this commands in my PC.It is working fine....
To open notepad in minimized mode:
start /min "" "C:\Windows\notepad.exe"
To open MS word in minimized mode:
start /min "" "C:\Program Files\Microsoft Office\Office14\WINWORD.EXE"
Try this
Go to the properties of the shortcut that points to the program (ALT ENTER or right click->properties); if there is no shortcut to it, you can make it by dragging and dropping the program while holding CTRL SHIFT;
Click in the Normal window dropdown, and choose minimized;
Save and run the shortcut.
You could try using the third-party tool called NirCmd. It is a genuine, free command line utility. If or when you have it, use this code in a batch file:
title Open Word
nircmd win hide title "Open Word"
start "C:\Program" "Files" "(x86)\Microsoft" "Office\Office12\WINWORD.exe
nircmd wait 20
nircmd win min foreground
exit
This program, in order, changes its title, hides itself according to its title, starts Word, waits 20 milliseconds as a buffer for Word to settle, minimizes Word by assuming it is now the top window, and then exits itself. This program should work as intended as long as their are no key presses or clicks in that ~50 millisecond time window, which shouldn't be hard.
As for installing nircmd on your computer, use this link, and click "Download NirCmd" at the bottom of the page. Save the .zip folder to a normal directory (like "My Documents"), extract it, and copy "nircmd.exe" to %systemroot%\system32, and there you go. Now you have nircmd included with your command line utilities.
Try:
start "" "C:\Program Files (x86)\Microsoft Office\Office12\WINWORD.EXE" --new-window/min
I had the same problem, but I was trying to open chrome.exe maximized. If I put the /min anywhere else in the command line, like before or after the empty title, it was ignored.
Local Windows 10 ActiveMQ server :
#echo off
start /min "" "C:\Install\apache-activemq\5.15.10\bin\win64\activemq.bat" start
Its actually not so simple.
It depends what you're trying to do and how the program behaves/interacts with Windows and UAC.
Certain programs will not start from a shortcut (for whatever reason that Windows determines). I have such a case with ViceVersa. I wanted to run the scheduler (VVScheduler) and no way could I get it to run via a shortcut in the user startup folder"s". Even with UAC disabled. Just would not start. Even tried adding it direct to the registry, no luck. So I was confined to using a batch file to run it at startup.
In my case I was unable to get it to open minimized, I tired the various syntax options offered in this post, none worked for me. I've resorted to just clicking the "-" on the VVScheduler window after startup.
For the people which are looking for the opposite (aka fullscreen), it's very simple. Because you just have to replace the settings /min by /max.
Now the program will be open at the "maximized" size !
In the case, perhaps you will need an example : start /max explorer.exe.
The answer is simple. Just look at the image.

Batch: start application doesn't show a GUI

I try to launch a self written autoit application called "KeyShortcuts.exe" using a batch called "launchMacros.bat". This applications provides keyboard shortcuts for various things and includes a GUI which shows me the available shortcuts.
launchMacros.bat:
start "MyMacros" "M:\applications\AutoIt\KeyShortcuts.exe"
The application does start and I'm able to use every shortcut but I'm not able to see the GUI.
If I start the application direct (double click on KeyShortcuts.exe) everythings works fine.
I also tryed starting the application using runas:
runas /user:REQUIREDUSERNAME /savecred "M:\applications\AutoIt\KeyShortcuts.exe"
Same problem here. Even right click -> "Run as administrator" doesnt worked.
Any suggestions?
If your batch file is in a different directory than KeyShortcuts.exe, you may need to specify the starting directory using the /D parameter for START.
Like this:
START "MyMacros" /D "M:\applications\AutoIt" "M:\applications\AutoIt\KeyShortcuts.exe"
Every batch file launched from Windows GUI create a new console window, run the batch file, then close. If you need this to be different, there's several ways:
Create a shortcut to CMD /K YOURBATCHFILE.BAT
Add a pause to your BAT file
Here's a demonstration of method 1:
New > Shortcut
Type the location of the item: C:\Windows\System32\CMD.EXE
Type the name for this shortcut: InsertYourNameHere
Click Finish
Right click on your Shortcut and go properties
Change Target to: C:\Windows\System32\CMD.EXE /K "InsertYourBatchFileName.BAT"
Click OK
Done, now you have a shortcut that opens a new console window and leaves it open whilst ir runs your batch file.

create a program that can run a cmd prompt

I have a program that changes my desktop wallpaper by dragging the picture file onto it. I also have a wireless network program that can auto open programs everytime it connects to a certain network.
I want to change my desktop everytime it connects to a certain network, but running the wallpaper program doesn't do anything unless I drag the picture onto it. However, I can also run a cmd prompt "c:/program.exe picture.jpg"
I tried creating a batch file START C:/PROGRAM.EXE PICTURE.JPG, but it doesn't work.
So basically I am trying to create a program that can run the cmd prompt "c:/program.exe picture.jpg" - can you help, please?
Remove the "start" from the batch file, and make sure any paths with spaces in them are enclosed in quotes, otherwise they'll be broken into arguments.
For example:
"C:\Program Files\MyProgram.exe" "C:\Documents and Settings\Me\MyPicture.jpg"
A batch job should work. Try skipping that START from your example.
Start - Run - Type :
cmd /c "start /max ""C:\Program Files\MyProgram.exe"" ""C:\Documents and Settings\Me\MyPicture.jpg""" .
The cmd /c - starts a new cmd instance and quits

Resources