Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
335 views
in Technique[技术] by (71.8m points)

Modify cmd.exe properties using the command prompt

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:etcetc >" 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=%~d0in;%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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Regarding setting the buffer size:

Using mode con: cols=XX lines=YY sets not only the window (screen) size, but the buffer size too.

If you specify a size allowed by your system, based on available screen size, you'll see that both window and buffer dimension are set to the same value; .e.g:

mode con: cols=100 lines=30

results in the following (values are the same):

  • window size: Width=160, Height=78
  • buffer size: Width=160, Height=78

By contrast, if you specify values that are too large based on the available screen size, you'll see that the window size changes to its maximum, but the buffer size is changed to the values as specified.

mode con: cols=1600 lines=900

With a screen resolution of 1280x1024, you'll get:

  • window size: Width=160, Height=78
  • buffer size: Width=1600, Height=900

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...