Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to write a batch script which configures this list of commands:

  1. Put the name of the window "Cmd configuration"
  2. Put the color of the text in green.
  3. Put the prompt character "$"
  4. Show the message "Cmd is configured"
  5. Ends by keeping the window open..

This is what I already have:

@echo off  
title cmd configuration  
color a  
prompt $  
@echo off  
Echo cmd is configured
share|improve this question
1  
I've reopened this but you might want to add an actual question here. Doesn't the script work for you? –  slhck Jan 23 '13 at 22:10
add comment

2 Answers

This will do all that you asked.

@echo off
cmd /k "title Cmd configuration& color A & prompt $$ & echo Cmd is configured"

Output:

Cmd is configured

$

This next one removes that blank line between the prompt and message.

@echo off
cmd /k "title Cmd configuration& color A & prompt $$ & <nul set /p =Cmd is configured"

Output:

Cmd is configured
$
share|improve this answer
add comment

You want to write a batch script (.BAT) that executes the list of commands. The name of the window can be anything, just use the form TITLE [title here]. The command to make the text green is in fact COLOR A, and the prompt character can be changed by using PROMPT $. Saying "Show the message" is a little vague, because you might want to have a message box pop up, or you might want to have it show in the command prompt. ECHO does print these characters, but unfortunately, it cannot keep the window open. However, you can pause the exit by using PAUSE. Therefore, your script should be as follows:

@ECHO OFF
TITLE Cmd configuration.
COLOR A
PROMPT $
ECHO\ Cmd is configured.
PAUSE

Note that you can test a batch script by double-clicking on it.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.