This page is edited from the 1cmdfaq.txt faq-file contained in
my tscmd.zip
command line interface (CLI) collection. That zipped file has much
additional material, including a number of detached .cmd script
files. It is recommended that you also get the zipped version as a
companion.
Please see "
The Description and
the Index page" for the conditions of usage and other such
information.
3} How can I customize the Command Prompt Window with script commands?
In fact the "cmd" method in
the
previous solution is the basis for an answer to a similar
question "How can I customize the Command Prompt window with script
commands?". The answer is that you first give all the commands you
want, then conclude with "
cmd". And
naturally prepare a desktop icon to point to your script so that you
can open the window you have customized. Below is one example.
@echo off
echo +----------------------------------------+
echo ^| CMDBOX.CMD CLI box by Prof. Timo Salmi ^|
echo ^| Last updated Sat 15-November-2003 ^|
echo +----------------------------------------+
echo.
::
:: Check about the Windows version
if [%OS%]==[Windows_NT] goto _doit
echo This script is for Windows NT/2000/XP/.. only.
echo Or have you tampered with the predefined variables?
pause
goto _out
::
:_doit
:: Augment the Windows path (customize as appropriate) and show
path c:\mytools;%path%
path
::
:: Select the fastest keyboard repeat-rate,
mode con: rate=32 delay=1
::
:: Select the code page Multilingual Latin 1
mode con: codepage select=850
::
:: Choose (e.g.) blue background and bright white foreground
color 1F
::
:: Make a home folder and go there
if not exist c:\_h mkdir c:\_h
c:
cd c:\_h
echo cd c:\_h
::
:: Tag that we are in the Command Prompt Windows so that,
:: if need be, scripts can be made aware if they are being
:: called in the window instead a direct call from an icon
set cmdbox=true
::
:: Finally, start "a new instance of the command interpreter"
cmd
::
:: The exit in case something went wrong
:_out
If you just want to skip all that output, redirect to nul. For
example
mode con: codepage select=850 >nul
To suppress the "Microsoft Windows" announcement, add switch /k to
the command interpreter calling line:
cmd /k