Automated setup of DOS command window

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
miskox
Posts: 348
Joined: 28 Jun 2010 03:46

Re: Automated setup of DOS command window

#16 Post by miskox » 21 May 2014 12:00

I would like to automate another thing:

is it possible to set the DOS (CMD) window position from batch file? (so it is always at the same XY position).

Saso

acferrad
Posts: 17
Joined: 21 May 2014 09:11

Re: Automated setup of DOS command window

#17 Post by acferrad » 21 May 2014 12:04

I'm sure I saw that when I found the powershell solution (above) to the buffer/window width/height issue. Check the powershell command.
I didn't see a need so I ignored it.

einstein1969
Expert
Posts: 774
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: Automated setup of DOS command window

#18 Post by einstein1969 » 21 May 2014 12:52

Hi,

i don't know powershell, but i think that powershell can resolve this.

I know a method for create a configuration for a dos windows with a given title.

You can view the usage in this post

I hope this is usefull

einstein1969

acferrad
Posts: 17
Joined: 21 May 2014 09:11

Re: Automated setup of DOS command window

#19 Post by acferrad » 21 May 2014 14:01

This all said, I'd still like to find a code solution to items 1 and 3 above, since I am writing scripts that others will use, and I can't rely on them to mess around with CMD properties!

miskox
Posts: 348
Joined: 28 Jun 2010 03:46

Re: Automated setup of DOS command window

#20 Post by miskox » 21 May 2014 14:33

Looks like the solution is already here: viewtopic.php?f=3&t=4285

Saso

acferrad
Posts: 17
Joined: 21 May 2014 09:11

Re: Automated setup of DOS command window

#21 Post by acferrad » 21 May 2014 14:38

Maybe it solves your problem, not mine... sigh

miskox
Posts: 348
Joined: 28 Jun 2010 03:46

Re: Automated setup of DOS command window

#22 Post by miskox » 21 May 2014 14:44

Yes, of course. Sorry for 'stealing' your thread. Maybe admin can delete these unnecessary posts.

Saso

acferrad
Posts: 17
Joined: 21 May 2014 09:11

Re: Automated setup of DOS command window

#23 Post by acferrad » 21 May 2014 14:50

@penpen
@foxidrive

So is there a code solution to items 1 and 3? The above solutions only work for me- not the other users that use my scripts.

miskox
Posts: 348
Joined: 28 Jun 2010 03:46

Re: Automated setup of DOS command window

#24 Post by miskox » 21 May 2014 15:00

These settings are saved in the registry at:

Code: Select all

HKCU\Console\%SystemRoot%_system32_cmd.exe

Maybe you could update these settings to:

Code: Select all

QuickEdit REG_DWORD 1
FaceName REG_SZ "Lucida Console"


just before starting (see this: viewtopic.php?f=3&t=4285) the new instance of .cmd and remove these settings (restore previous settings if any)?

I took another look at your post viewtopic.php?p=34609#p34609 and I see that your original .cmd window has a title of 'Visual Fortran ....'

Maybe this is the reason why things are not working as expected? Maybe you should modify those settings?

If I set the settings mentioned in the beginning of this post everytime I 'START' a new .cmd window it has Lucida Console font etc.

Saso

(XP PRO, 32bit)

acferrad
Posts: 17
Joined: 21 May 2014 09:11

Re: Automated setup of DOS command window

#25 Post by acferrad » 22 May 2014 00:12

That seems to work! Although I had hoped not to have to go into the registry as this needs Admin rights.

Just tried to query this value:

D:\>reg query "HKCU\Console\%SystemRoot%_system32_cmd.exe" /v FaceName
ERROR: The system was unable to find the specified registry key or value.

Since:
SystemRoot=C:\Windows

I suspect it's the \ in C:\Windows which confuses reg.exe
I tried \\ but that didn't work, so I'm not sure what the syntax is for:

reg query "HKCU\Console\C:\Windows_system32_cmd.exe" /v FaceName

Squashman
Expert
Posts: 4153
Joined: 23 Dec 2011 13:59

Re: Automated setup of DOS command window

#26 Post by Squashman » 22 May 2014 06:26

Code: Select all

C:\Users\Squashman>reg query "HKCU\Console" /v FaceName

HKEY_CURRENT_USER\Console
    FaceName    REG_SZ    Terminal

acferrad
Posts: 17
Joined: 21 May 2014 09:11

Re: Automated setup of DOS command window

#27 Post by acferrad » 22 May 2014 06:46

No, FaceName for me is not in the key Console, it is in a key beneath Console called %SystemRoot%_system32_cmd.exe:

HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe

This is the problem: %SystemRoot% has a backslash in it.

Squashman
Expert
Posts: 4153
Joined: 23 Dec 2011 13:59

Re: Automated setup of DOS command window

#28 Post by Squashman » 22 May 2014 07:37

Is the Key name acutally %SystemRoot%?

Then I would try this in a batch file.

reg query "HKCU\Console\%%SystemRoot%%_system32_cmd.exe" /v FaceName

acferrad
Posts: 17
Joined: 21 May 2014 09:11

Re: Automated setup of DOS command window

#29 Post by acferrad » 22 May 2014 07:44

Nope, still not working:

D:\>reg query "HKCU\Console\%%SystemRoot%%_system32_cmd.exe" /v FaceName
ERROR: The system was unable to find the specified registry key or value.

Here is my regedit view:
Image

Squashman
Expert
Posts: 4153
Joined: 23 Dec 2011 13:59

Re: Automated setup of DOS command window

#30 Post by Squashman » 22 May 2014 07:45

In a BATCH file. Not at the cmd prompt.

Post Reply