How can I change the width of a Windows console wi

2019-01-14 01:49发布

Is it possible to programmatically, or otherwise, increase the width of the Windows console window? Or do I need to create a wrapper program that looks and acts like the console somehow? Are there any programs around that do this already? I use Cygwin extensively in my development, and it seems a little ridiculous to me that all console windows in Windows are width limited.

If it matters at all, I'm running Windows XP.

11条回答
老娘就宠你
2楼-- · 2019-01-14 01:53

There is a window's api function to set the width. Here's a tut on it. http://www.adrianxw.dk/SoftwareSite/Consoles/Consoles6.html

查看更多
在下西门庆
3楼-- · 2019-01-14 01:56

Click on the icon on the top left of the console frame (the one that looks like "C:\"), then select Properties . This lets you customize all kinds of stuff. The "layout" tab has the width of the window.

查看更多
混吃等死
4楼-- · 2019-01-14 01:56
system("mode 45, 20");

This is a bad solution because it disables vertical scrolling.

This is better:

system("mode CON: COLS=120");
查看更多
不美不萌又怎样
5楼-- · 2019-01-14 02:00

Hey have you guys here ever thought of the possibility of launching and running Cygwin from within the windows command prompt/console? This is what I always do. Then you can do anything you want to the look of the console to make it sexy.

trying to get su from within cygwin can be difficult at times, especially when you are attempting to do some heavy crunching with the tools provided. People have tried all sorts of things from sudo SU for windows to what ever...when it can be as simple as passing on the administrator credentials from you the "user" (if you are the admin?) even without weird UAC pop ups. You can do this via a simple batch script. Have a below this of a screen grab of what my Cygwin looks like and this is running from a portable version of Cygwin too! No registry entries and any of that rubbish!
The batch file passes the credentials to bash and then bash changes directory (notice the double quotes are needed to pass this variable to the Cygwin colsole in order for it to work)

@echo off
setlocal enabledelayedexpansion
REM Changing working folder back to current directory
%~d0
CD %~dp0
REM Folder changed
bash --login -i -c "cd {insert_directory_name_here} && exec ./execution-file-here"
cls
exit 1

Note: the brackets like so { } in the above example are NOT included in the batch script. also note that windows CMD window is passing off the string to cygwin to interpret as multiple conditions; cygwin doesn't read the quotes them selves but whats between them. the && is saying change directories and when you do execute the script ./execution-file-here when you get there.

It's a double whammy you can launch a Cygwin or linux like application from within a MS-Windows window and not even type a letter of code or open a console or anything.

I keep this batch file inside of the /Cygwin/bin directory and create a Windows shortcut link on the desktop. Within the shortcut I can stylise the cmd shell window. Even go as far as transparency ;-)

enter image description here

enter image description here

查看更多
我命由我不由天
6楼-- · 2019-01-14 02:00

You can increase it manually by right-clicking the tray icon and entering the options dialog.

There are also third-party terminal emulators for Windows, such as Console:

Screenshot of Console http://i37.tinypic.com/2ueu1ag.jpg

查看更多
我命由我不由天
7楼-- · 2019-01-14 02:06

Simply run "mode cols,lines" to change the size of the current console window:

mode 120,60

will resize the console window to 120 columns and 60 lines

查看更多
登录 后发表回答