open program minimized via command prompt - windows

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.

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.

Hide CMD window after execute command line by the RUN

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.

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.

CMD Script: How to close the CMD

I have created a small command that will let me launch Internet Explorer. However, I wish to close the small command prompt that shows up when I launch IE. How can I do this? This is my current code:
"%ProgramFiles%\Internet
Explorer\iexplore.exe"
http://localhost/test.html
PAUSE
I am guessing if I take out the Pause. It will close the CMD box upon closing IE??
Also is there another command that I can use to simply create a command that will let me add something to the Menu with a small icon, which in turn runs the above. Is this complicated? Any tutorials I can use?
Thanks all
Use the start command:
start "title" "%ProgramFiles%\Internet Explorer\iexplore.exe" http://www.example.com
you need this on the end
&& exit
For example
"%ProgramFiles%\Internet Explorer\iexplore.exe" http://google.co.uk && exit
#echo off
start "" "%ProgramFiles%\Internet Explorer\iexplore.exe" "http://www.example.com"
exit /b
But you really should not force IE, but use the default browser:
#echo off
start http://www.example.com
exit /b
exit /b does not work on win9x IIRC, so if you need to support every version of windows and close the terminal window if the user double clicks your batch file, go with:
#echo off
start http://www.example.com
cls
You can also launch your program with the /c switch, which terminates the cmd once its finished executing
for example
cmd /c "%ProgramFiles%\InternetExplorer\iexplore.exe" http://localhost/test.html
You have to add 'start' in front of every program you launch, elsewhere your script is going to wait until it's finished.
A little late here, but running it in minimized mode or invisible mode might be another option. Source: https://www.winhelponline.com/blog/run-bat-files-invisibly-without-displaying-command-prompt/
Running .BAT or .CMD files in minimized mode
To run a batch file in a minimized window state, follow these steps:
Create a shortcut to the .BAT or .CMD file. To do so, right click on the file, click Send To, Desktop (create shortcut)
Right click on the shortcut and choose Properties
In the Run: drop down, choose Minimized
Click OK
Double-click the shortcut to run the batch file in a minimized window state.
"Mind the gap!"
Command Prompt always takes the empty space as separator, unless it's enclosed in double quotes.
So, if any Path, or Program/File Name, or anything includes empty space/es, must closed in quotes.
eg. "C:/Program files/..." path/directory or "Any Program/Command/File.exe/cmd/txt..." Program/Command/File Name includes space/es.
Syntax:
> start /?
Starts a separate window to run a specified program or command.
START ["title"] [/D path] (start swiches here...) [command/program] (com/prog-parameters here)
start "" /d "Drive:/the/Program/Path/..." "Command/Program Name.extension" "File-Name.extension"
So, it's usual fault:
If you don't set the 1st set of quotes "" for title (even if there's nothing to enclose), then the START command takes whats inside the 1st quotes set (eg. path! or Program Name!) and sets it as title... and of course, it messing up.

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