Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

maximize running dos window

maximize running dos window

maximize running dos window

Good afternoon all,
i hope the weather is as sunny as it is munich,,lovely.
quick question.
i have a bat file which is executed minimized from a vb app. i would like to have the dos window visible as it shows debugging info to the user. does anyone know a dos command to run in the batch file to maximise its window?
I appreaciate i could call the batch file from the vb app which calls another batch file maximised but i dont want the extra file, call me pick-eee

von moyla

RE: maximize running dos window

yes, yes i do.

at the command prompt or within a batch file:

mode con: cols=xxx lines=xxx

con: defines that its for the command window.
cols and lines are obviously the number of columns and lines
the window shall take......
for a near full size window but not max a cols=140 and lines=60 is close....

this works for windows 2000. but sure about other o/s's.

hope this helps

RE: maximize running dos window

It works under NT as well - good answer...

RE: maximize running dos window

hello ccastelein,
sorry i havent got back to you.
thanks for the great response, i shall use this. might even comment in your name in the script for the browneee points.

von moyla

RE: maximize running dos window

hmm shame to break up the party but it doesnt quite do what i hoped. running the command does change the size of the dos window but doesnt maximize it!! will keep looking

RE: maximize running dos window

Since you are using VB, I presume you are using VB's Shell command to start the BAT file.  If you are using SHELL you can try to use the following:

Dump1 = Shell("RunThis.bat", vbMaximizedFocus)
Dump1 = Shell("RunMax.bat", 3)

FYI from VB4's help file:

Shell(pathname[, windowstyle])

Where the "windowstyle" has one of the following:

0 = vbHide (Window is hidden and focus is passed to the hidden window.)

1 = vbNormalFocus (Window has focus and is restored to its original size and position.)

2 = vbMinimizedFocus (Window is displayed as an icon with focus.)

3 = vbMaximizedFocus (Window is maximized with focus.)

4 = vbNormalNoFocus (Window is restored to its most recent size and position. The currently active window remains active.)

6 = vbMinimizedNoFocus (Window is displayed as an icon. The currently active window remains active.)


Let us know if this helps or not.  Hopefully it does.

RE: maximize running dos window

Hello MiggyD
Thanks for this. I am using the command you mention. Unfortunately i dont want the default bahavour of a launched bat file to be maximized.
The VB app is a tool for installing windows XP clients. its takes an input of an ini file which lists software jobs, some 60 at the moment. the jobs have command sections to tell the VB app to reboot before, after, to sleep for a certain time, to pause(for debuggin) etc etc. I could add another command to specify the window status for a particular batch file. i dont want to do this as 95% of the time the jobs arent batch files but additional ini files so i cant be bothered to release a new version. cheers for the input though

von moyla

RE: maximize running dos window

"I could add another command to specify the window status for a particular batch file."

Why would you create a seperate line for each file you want to maximize?

If you have the source code (where it supposed to "pause(for debuggin) etc etc) you could simply add an IF/ENDIF statement to the SHELL command like:

Public Sub MyPause4Debug(SomeBatch As String, WinStyle As Integer)
    If WinStyle > 0 Then
        Dump1 = Shell(SomeBatch, vbMaximizedFocus)
        Dump1 = Shell(SomeBatch)
    End If
End Sub

It wouldn't necessarily be a Major Version change, just a Minor one.


RE: maximize running dos window

ok, 2install.exe is passed a jobs list. this list is an ini file of the following format


The above are 3 example jobs that the 2install.exe must perform. The line is delimited by a $
The first substring is file to run.
If the file is an ini file a Wrapper.exe is called. This Wrapper.exe is a gui based tool that the user can see how long the install can take, how much space it will take up, accept license agreements, cancel the install etc.
If the file is a vbs or a bat file the file is executed minimized.

my "I could add another command to specify the window status for a particular batch file." was refering to the second substring "nosleep;noreboot". commands to the 2install.exe delimited by ";" you can reboot after the job has run, sleep for a certain time, have a prereboot, pause etc etc. I was meaning i could potentially add a "maximize" option so that you can specify the criteria and then add the if then statement you have suggested.

However, I am of the opinion that a "job", being a batch file, vbs, exe, cmd, wsf etc etc etc should be responisible for its execution state. ie if that batch file wants to be run maximized that is no concern of the 2install.exe. It should be the job of the called "job".

That was the reason for the post, the guy who keeps perstering me to change the app just so his flippin batch file can show some crap message. lord knows why you he cant take his head out of his arse and ditch the sandals. anyhow i digress

von moyla

RE: maximize running dos window

Start the Window with the START command.

Enter  START /?  |  MORE  in a DOS window to see the options, which include minimizing, maximizing, or "regularizing" the window as well as whether to wait on the command to finish, what to put in the DOS window's title bar, etc.

START came in with Windows 95 so it's there in that and any newer (32-bit) Windows version.

- Chuck Somerville

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close