改变的命令提示符的布局 [英] change the layout of cmd prompt
问题描述
我要改变通过批处理文件中的命令提示符布局。它需要在中心或在屏幕上的某些位置上被显示,但不能在最高层。我想:
I want to change the command prompt layout through batch file. It need to be displayed at center or at some position of the screen, but not at the very top. I tried:
@echo off
COLOR 8f
mode con:cols=80 lines=40
mode con:top=10
的模式CON:COLS = 80行= 40
命令工作,但模式CON:顶部= 10
不是。结果
请给我建议的权利实现它。
The mode con:cols=80 lines=40
command is working, but mode con:top=10
is not.
Please suggest me right of achieving it.
推荐答案
要控制一个窗口的属性,你必须
To control the properties of a window, you have to
-
在在某些标题注册表创建一个配置文件。 Windows使用注册表来存储基于窗口标题命令提示符窗口中的设置。
create a profile in the registry under some title. Windows uses the registry to store the settings for command-prompt windows based on the window title.
打开一个窗口,匹配在配置文件中使用的标题
open a window with a title that matches the one used in the profile
使用以下code作为一个样本,让你开始。
Use the following code as a sample to get you started.
@echo off
setlocal
set mycmdTitle=My Special Command Prompt
Set mycmdHeight=40
Set mycmdWidth=80
Set mycmdBufferHeight=500
Set mycmdBufferWidth=%mycmdWidth%
Set mycmdxPos=0
Set mycmdyPos=120
Set mycmdColor=8f
Set /A mycmdBufferSize=mycmdBufferHeight*0x10000+mycmdBufferWidth
Set /A mycmdWindowPos=mycmdyPos*0x10000+mycmdxPos
Set /A mycmdWindowSize=mycmdHeight*0x10000+mycmdWidth
Set mycmdCmd=Title My First Command Prompt^&Echo.^&Echo.^&Echo.^&Echo.
Call :StartCommandPrompt %mycmdBufferSize% %mycmdColor% %mycmdWindowPos% %mycmdWindowSize% "%mycmdTitle%" "%mycmdCMD%"
endlocal
Goto :EOF
:StartCommandPrompt
REM receives %1=BufferSize %2=Color %3=WindowPos %4=WindowSize %5=Title %6=cmd
reg add "HKCU\Console\%~5" /V ScreenBufferSize /T REG_DWORD /D %1 /F >nul
reg add "HKCU\Console\%~5" /V ScreenColors /T REG_DWORD /D 0x%2 /F >nul
reg add "HKCU\Console\%~5" /V WindowPosition /T REG_DWORD /D %3 /F >nul
reg add "HKCU\Console\%~5" /V WindowSize /T REG_DWORD /D %4 /F >nul
start "%~5" %COMSPEC% /K %6
goto :eof
这code是基于一些原创code有一次,我在谷歌找到,但我不能找回它,所以我不能给适当的归属其原来的开发者。
This code is based on some original code I once found on google, but I can't retrieve it so I cannot give the proper attribution to its original developer.
这篇关于改变的命令提示符的布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!