Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How do I center batch files when they open up? I mean not by dragging but every time they open up they are automatically centered like is there a command? I am trying to make a game like that. And these are the game files I want to be centered. They're separate:

@echo off
type c1.txt
gotoxy 0 1
ping localhost -n 2 > Nul
start c2.bat
exit
share|improve this question
What do you mean by "center batch files"? Do you want the window that execute the batch file to be centered on the screen? Or do you want some content inside the window to be centered? – dolmen Mar 27 '11 at 11:41

2 Answers

You can do this with IE popups using VBS, but as far as I am aware that cannot be done to manipulate an existing command prompt. You may want to try using an AutoHotkey script within the batch file to do something like (A_ScreenWidth/2)-(Width/2), or use CenterWindow() in VC.

share|improve this answer

In the days of DOS, you used to be able to manipulate the screen output by loading up the ANSI.SYS driver and using ESCape sequences or by creating your text/images using an app like thedraw.

Checking for a modern solution for ANSI.SYS I came across ANSICON. With this app/utility installed, putting ANSI escape sequences in your txt file may work - I can't try it at the moment as I only have a Linux laptop at my disposal so feedback would be useful!

Edit: Thinking about things, I don't believe this will make centring text any easier as I cannot find an ANSI sequence that defines 'centre text' on a display - only for a printer - but this may be of use for designing screens so I will leave the answer here as it is.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.