You are not logged in.

#1 25 Jan 2020 05:14

Rekrul
Member
Registered: 17 Apr 2016
Posts: 98

Using the MODE command to change the size of a window?

The page for the Mode command says that you can set the display size with;

MODE CON[:] [COLS=c] [LINES=n]

This doesn't work for me in XP. If I include the following command in a script;

mode con: cols=100 lines=50

Nothing happens. It opens a normal 80x25 line window.

If I use;

mode con: cols=100

If gives me the correct width, but it makes the window the entire height of the screen.

To get a 100x50 display, I have to use;

mode con: cols=100
mode con: lines=50

This also works;

mode 100, 50

Which the page says is undocumented.

Is it supposed to work this way?

Two more questions:

1. Why is it written "CON[:]"? In other words, why is the colon encased in brackets? It seems to work without the colon.

2. If I include the two Mode commands to set the columns and lines in a script, is that going to also work on Windows 7-10?

Offline

#2 27 Jan 2020 12:29

bluesxman
Member
From: UK
Registered: 29 Dec 2006
Posts: 1,129

Re: Using the MODE command to change the size of a window?

Square brackets usually indicate something optional.  Since CON is a reserved file name, it makes sense that the ":" might not be required.

Seems to work as advertised on Win2008, Win2019... Can't speak for XP.  Also, eek, Windows XP?  yikes


cmd | *sh | ruby | chef

Offline

#3 28 Jan 2020 21:25

Rekrul
Member
Registered: 17 Apr 2016
Posts: 98

Re: Using the MODE command to change the size of a window?

bluesxman wrote:

Square brackets usually indicate something optional.  Since CON is a reserved file name, it makes sense that the ":" might not be required.

Seems to work as advertised on Win2008, Win2019... Can't speak for XP.

It works under XP, if I use a separate command each for the lines and columns. I just wasn't sure if all newer version of Windows obeyed it properly. I mean they have DPI settings, the theme can affect the fonts, etc. I have my system set to a bog-standard classic theme with standard sized fonts and a 1024x768 display. I could set it higher, but then I have to mess with font settings or the text is so small I have to squint at it. So I just use a (relatively) low resolution. And when I make assumptions that something will look the same across all systems, I usually end up being wrong. smile

bluesxman wrote:

Also, eek, Windows XP?  yikes

Well...

I'm poor. When I bought this system refurbished, Windows 7 was still relative new. Vista had been out for a while, but nobody wanted that. Since there were reports of driver and compatibility problems, and I got a good deal on this machine with XP Pro installed, that's what I got.

I'd like a newer, faster system, but I really don't have the money to spare and I don't like Windows 10. I don't like the spyware and the forced updates. I'd rather have Win7, even though I'm aware that it's no longer supported and that MS cut off updates to certain types of systems running it in an effort to force people into Win10.

I could install Win7 on this machine, but that means I'd have to buy a copy and to install it properly I'd have to nuke the entire system and start over from scratch. I'd have to re-install and re-configure everything, which is a PITA, considering that most programs save their settings to obscure registry entries rather than INI files. I mean, if they want to use entries in the registry as a form of copy protection so you can't just copy the program directory to another machine, so be it, but why not offer to write the settings to a file so that once the program has been legally installed on the new system, you can just import the settings and have everything all set up?

I'd rather not wipe a functioning system if I don't absolutely have to. Honestly, besides not being able to run the latest version of new programs, the biggest problem with using an older system is accessing web sites. While I get that sites have to work properly on the latest web browsers, this also seems to mean that they have to be made to break on older versions. I'm not talking about a few functions that don't work, but entire sites that come up blank. Or that the formatting is all screwed up. Many people have told me that I can't expect modern sites to work on old browsers. You mean older browsers can't display text or images? I'm not asking that they test their site on every old browser version, but it would be nice if they didn't use fancy Javascript tricks that completely break the site.

Offline

#4 29 Jan 2020 01:28

Simon Sheppard
Admin
Registered: 27 Aug 2005
Posts: 1,130
Website

Re: Using the MODE command to change the size of a window?

I have a vague memory that MODE was one of the commands which changed substantially when Vista came out.

For a while I had both sets of syntax, but now that almost no-one is still using XP, I removed the old syntax. Also really no-one should be connecting an XP machine to the internet.

If you really need it, you can find old versions of SS64.com pages on archive.org

Offline

#5 29 Jan 2020 02:40

Rekrul
Member
Registered: 17 Apr 2016
Posts: 98

Re: Using the MODE command to change the size of a window?

Simon Sheppard wrote:

I have a vague memory that MODE was one of the commands which changed substantially when Vista came out.

For a while I had both sets of syntax, but now that almost no-one is still using XP, I removed the old syntax.

If you really need it, you can find old versions of SS64.com pages on archive.org

Well, according to this page on NT/XP commands from 2005, the syntax for Mode seems the same.

https://web.archive.org/web/20050825190 … /mode.html

And strangely, NOW including both the lines and cols arguments on the same line works. Before I posted the first message in this thread, I tested it a dozen times, trying out every variation and it never once worked with both on the same line no matter what order they were in. Now it does. roll

I can't prove it, but one day I was working on a script and an IF statement was triggering on the opposite condition. If I told it to do something on a match, it did nothing, even though I used Echo commands to verify that the variables did indeed match. Then I added a "Not" and it triggered, even though the variables matched. I was about to come on here and post about it, but I nuked the script and started over and it worked as expected. You're probably thinking "user error", but I swear I checked every possible cause and it was working the opposite of how it was supposed to.

Just yesterday I made some changes to a script and when I tested them, it would instantly close, even though it should have just jumped to a different part. I couldn't see any reason this was happening. Eventually I gave up, erased the revised copy, went back to my original and made the same changes again and this time it worked. Granted, maybe I may have made a typo somewhere, but how does the result of an IF statement cause the entire script to just close? It performed a comparison and set a variable if the condition was met, then jumped back to the main part of the script. I added pause commands before and after the IF statement and both of those executed fine. It crashed when I jumped back to the main part of the script even though at that point, all it did with the variable was update the menu to display its value.

All it was doing was toggling the value of a variable. If the variable was 0, it changed it to 1, else it changed it to 0, then it jumped back to the menu which displayed one of two different lines based on the variable. The menu worked, the IF statement worked, but the script crashed. WTF? I added the exact same code a second time and it worked fine.

Simon Sheppard wrote:

Also really no-one should be connecting an XP machine to the internet.

I'm careful about what sites I go to and what software I download. I have an anti-virus and third party firewall installed. All evidence suggests that there's no viruses or malware on my system. Meanwhile my friend with Win10 and Norton's has had about three viruses in the last year and he doesn't even go on any questionable sites, let alone shady ones. Oh, I also have about 90% of advertising servers blocked via my Hosts file using the MVP hosts file, to which I instantly add any ad sites that manage to sneak through.

Offline

#6 08 Aug 2020 10:47

Minecraft49
Member
From: Poland
Registered: 08 Aug 2020
Posts: 10
Website

Re: Using the MODE command to change the size of a window?

Use

mode 40,20

where 40 is column count, and 20 is row count. It will 100% work on Windows XP.

Offline

Board footer

Powered by