views:

2774

answers:

4

Isn't that nicely recursive?

I've got a portable command prompt on my external drive, and it has a nice .bat file to configure some initial settings, but I'd like more!

Here's what I know how to set from .bat:

  • Colors = (color XY) where x and y are hex digits for the predefined colors
  • Prompt = (prompt $p$g) sets the prompt to "C:\etc\etc >" the default prompt
  • Title = (title "text") sets the window title to "text"
  • Screen Size = (mode con: cols=XX lines=YY) sets the columns and lines size of the window
  • Path = (SET PATH=%~d0\bin;%PATH%) sets up local path to my tools and appends the computer's path

So that's all great. But there are a few settings I can't seem to set from the bat. Like, how would I set these up wihtout using the Properties dialogue:

  • Buffer = not screen size, but the buffer
  • Options like quick edit mode and autocomplete
  • Popup colors
  • Font. And can you use a font on the portable drive, or must it be installed to work?
  • Command history options
+1  A: 

Regarding auto-completion:

File and Directory name completion is NOT enabled by default. You can enable or disable file name completion for a particular invocation of CMD.EXE with the /F:ON or /F:OFF switch. You can enable or disable completion for all invocations of CMD.EXE on a machine and/or user logon session by setting either or both of the following REG_DWORD values in the registry using REGEDT32.EXE:

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\PathCompletionChar

    and/or

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\CompletionChar
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\PathCompletionChar

with the hex value of a control character to use for a particular function (e.g. 0x4 is Ctrl-D and 0x6 is Ctrl-F). The user specific settings take precedence over the machine settings. The command line switches take precedence over the registry settings.

If completion is enabled with the /F:ON switch, the two control characters used are Ctrl-D for directory name completion and Ctrl-F for file name completion. To disable a particular completion character in the registry, use the value for space (0x20) as it is not a valid control character.

Couldn't find any command history options in there ( cmd /? ), and it looks like the other options you asked about are set exclusively through registry settings.

HanClinto
A: 

This is all very easy with TCC/LE -- the descendent of 4DOS/4NT which were popular command-shells. TCC/LE is now FREE!

http://www.jpsoft.com/tccledes.htm

William Leara
+1  A: 

Regarding buffer size.

When you're using "mode con: cols=XX lines=YY" command, it sets not only window(screen) size, but the buffer size too.

In the case when you set console window size the value which is allowed by your system

execute "mode con: cols=160 lines=78",
when Windows screen resolution is 1280x1024,
you'll get
console Window Size: Width=160, Height=78,
and Buffer Size: Width=160, Height=78

you'll see that buffer size changed to the same values.

In case when values you set larger than allowed by system, you'll see that window size changed to its maximum, but buffer size has the values that you set.

execute "mode con: cols=1600 lines=900",
when Windows screen resolution is 1280x1024,
you'll get
console Window Size: Width=160, Height=78,
and Buffer Size: Width=1600, Height=900

+1  A: 

For true Buffer Size adjustment use DOSKEY /LISTSIZE=size

You can't change colors within the shell anymore since Microsoft took ANSI ESC control out of the command/cmd prompts.

Steve