Batch file minimize with using coloured text - batch-file

Can anyone help me with a problem that I am having.
I have made a number of scripts that I run with calling the main script (Run.sikuli).
Now I haven't done much with batch files before, but I am trying to make a batch file to execute my scripts.
I have the following code:
#ECHO OFF
REM Change the colours: Background = Black, Letters = Light Green
color 0A
REM Start up the test scripts.
C:\Users\<userName>\Documents\SiKuLi\runIde.cmd -r C:\Users\<userName>\Documents\SiKuLi\Run.sikuli
I would like green text is my prompt, so we don't confise it some other prompt.
I also would like to get this window get minimized when it pops up.
I now I can use this code for that:
start /min
And it also works, but then my coloured text is white again because a new command prompt gets opened.
Does anyone know how to get my prompt minimized while keeping my coloured letters?

start /min "" cmd /c "color 0a & C:\Users\<userName>\Documents\SiKuLi\runIde.cmd -r C:\Users\<userName>\Documents\SiKuLi\Run.sikuli"
Run a color command inside the started console.

Related

Trying to open a new cmd window then run multiple commands in it

I am facing a rather annoying issue when trying to write a batchscript file for my assignment, the assignment asks me to open a new command prompt window, change its color and make it print the current windows version. I can make it open the new window and change the color but no matter what I do it will always execute any new commands including the ver command on the old command prompt window, I have tried using & to run multiple commands but it just does nothing.
start cmd /k color F1 & ver
pause
This is the code I have now, any help would be appreciated
To undertake the task you've specifically shown us, there is no need whatsoever to use the color command, and as a result, include an ampersand to join two commands.
If you open a Command Prompt window, type cmd.exe /? and press the ENTER key, you should see that there is a /T option you can use.
Start %SystemRoot%\System32\cmd.exe /T:F1 /D /K Ver
Have you tried
start "My assignment" cmd /k "color F1 & ver"
Note that the window title is the first quoted string in the start command.
Without double quotes only the "color f1" command is being passed to your new cmd window.
start cmd /k "color F1 & ver"
pause
I think will give you the results you want.

How do i keep the window size on my batch file after opening it in minimized mode?

I have a VBscript that runs a bunch of programs, one of them being a batch file. In the batch file i use:
Mode 50,8
This makes the window the right size and makes it look nice. However, in the cases where i open the batch file using the VBscript i want it to be minimized, that is done like this:
objShell.Run("path_of_my_batch_file"),7
The problem is that this makes the batch file completely ignore the instructions to stay at "Mode 50,8" and open the batch file in the default CMD size.
So my question is: How can i open my batch file in minimized mode using my VBS-file, but also let it keep the size?
Putting this at the top of the batch file workes:
Pause
Mode 50,8
But that means i have to press a key before it gets the right size and i defenetly dont want that. I need a way to either run the "Mode 50,8" command as soon as the batch file is no longer minimized or a way to let it keep the size after the VBS-file minimizes it.
The problem is that the mode 50,8 command desn't seem to have an effect while in minimized state.
There are
workarounds
with .appac tivate and then using sendkeys but
I'd prefer the 3rd party app NirCMD which enables the batch to minize/restore
itself.
' Q:\Test\2018\07\23\SO_51469493.vbs
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run("Q:\Test\2018\07\23\SO_51469493.cmd")
:: Q:\Test\2018\07\23\SO_51469493.cmd
#Echo off
Title Min5x80
Mode 80,5
Echo now minimizing using:
Echo nircmd win min title Min5x80
Timeout /t 5 & nircmd win min title Min5x80
Timeout /t 5 & nircmd win normal title Min5x80
cls
Echo back again
Pause
This will involve a flicker when running the batch.

Open CMD with specific color and title

I recently started learning batch and wanted to write a script that opens CMD with a specific color and title. This code opens my CMD and another plain one! How can i get rid of the plain cmd?
Start CMD
title Hacker's CMD
color 04
start cmd /k title Hacker's CMD^&color 04
The /k parameter executes the commands and leaves the cmd window open. To pass several commands use an escaped command separator ^& so that the separation occurs in the launched cmd, not in the original batch file.

What is the batch script to open another cmd window to run another line of script

I know that the question was not very clear, so I will try to make it clearer.
I am looking for the batch script command to open a cmd window that runs like a batch program.
I know the command exists as I have seen it used before and have used it before, however, as of late I have not been
able to find it or remember it. The command looks something like this
#echo off
start cmd.exe ("#echo off && echo second window opened && pause")
pause
It would open a second cmd window that read.
second window opened
press any key to continue...
And when you pressed a key the second window would close, just like a batch file cmd window would. As you probably can tell I am relatively new to batch scripts and am still a little iffy on how it works.
Not bad memory. Almost done
start "title" cmd /c "echo in other window & echo. & pause"
Type cmd /? and start /? to get all the needed information for this commands usage

creating a batch file for programs to start using a delay

I'm trying to write a batch file which starts some programs automatically with a delay. because it takes forever for my pc to start and i also get the unresponsiveness because of it.
this is how it looks like right now:
#echo off
TIMEOUT 5
start D:\somepath\someapp.exe
TIMEOUT 50
start "E:\somepath\someapp.exe"
because the last line is surrounded with quotation marks, the 'someapp.exe' didnt got started.
can someone explain why it didnt start the app? the first one however, did got started up.
also, how can i hide the command prompt?
thanks in advance!
See help start. The first quoted argument is treated by start as the command window title. So your quoted "E:\somepath\someapp.exe" was the tile of an empty command window. Where as unquoted E:\somepath\someapp.exe was an actual command.
If you need to quote the command, use another quoted string first as the window title.
start "Someapp Window Title" "E:\somepath\someapp.exe"
Or if you don't want to provide a window title, provide the path and command separately with /D switch
start /D "E:\somepath" someapp.exe
You can use the /B switch to stop creating a new window to start the command
start /D "E:\somepath" /B someapp.exe
Or you can use the /MIN switch to start the window minimized
start /D "E:\somepath" /MIN someapp.exe

Resources