# Solved: Batch cmd file for ipconfig /all maximized



## squeezin (Mar 22, 2006)

Hi there, im looking for a batch command to open a cmd window MAXimized, keep it open, and run ipconfig /all.....and preferably have it scroll back to the top after the command is run, for those computer with tons of adapters like vmware and whatnot...

Side note - It would be nice to have it do a true full screen maximize for the entire screen...but it looks like it will be dependent on previous cmd screen settings...?

Right now I use 130 width, 85 height on this computer....but i plan on using this batch file on random computers....so that screen size might get a little screwy with other computers i think...which is why the general full screen maximize setting would probably work best if possible.

Thinking about changing some colors aswell just for the heck of it.....but thats the least of my worries.


Thanks for reading.
Any and all help is greatly appreciated.


----------



## squeezin (Mar 22, 2006)

So i figured this much out...


```
start /max cmd /k ipconfig /all
exit
```
But for the life of me i cant seem to get the color changes i want in there to stay without screwing it up...

Im trying to put in COLOR 0A .....any ideas??


----------



## TheOutcaste (Aug 8, 2007)

```
start /max cmd /k "Color 0A & ipconfig /all"
```
I don't know of any way to scroll back to the top from the Command Prompt. For that, you'd need to use AutoIt or AutoHotKey, or use SendKeys in a VBScript.


----------



## squeezin (Mar 22, 2006)

Perfect !!! TY TY TY TY

any idea if its possible to have the cmd screen scroll back to the top after the command is run?
Like i mentioned before, on some computers that have tons of virtual and vmware adapters the list is never ending, thus usually have to scroll back up to the top to see the first LAN adapter

Just a thought....if not no biggie.

And good resources you can point me towards for cmd for dummies...
Almost everything I came across looks like it was written by an over caffienated sleep deprived programmer... 

TY again !


----------



## TheOutcaste (Aug 8, 2007)

TheOutcaste said:


> I don't know of any way to scroll back to the top from the Command Prompt. For that, you'd need to use AutoIt or AutoHotKey, or use SendKeys in a VBScript.


I've found these to have a lot of good info:

DOS and VB Scripting Links
An A-Z Index of the Windows XP command line
Command-line reference A-Z - WinXP
Command-line reference A-Z - Win2003
Command-line reference A-Z - Vista/Win2008

Using batch parameters
Windows 95/98/ME Batch file Tutorial (Still a good basic reference for WinNT/2K/XP)
Batch File Functions for NT4/2000/XP/2003
Rob van der Woude's Scripting Pages
Microsoft Script Center
Beginners Guides: WindowsXP Command Prompt
Beginners Guides: Understanding and Creating Batch Files
Windows Programming/Programming CMD - Wikibooks, open books for an open world
Batch File Programming for Windows: Writing Scripts for Execution from the Windows Command Line
Batch File Programming


----------



## squeezin (Mar 22, 2006)

Figures, i knew i would hit a snag on the scroll idea 
Thanks ill check em out.

Just to throw it out there:
1. Where would i add the "color 0A" to make the menu and results in color?
2. When i run option 3 and 4, (release renew) it always says the "operation cannot be performed....media disconected"
It only attempts to release or renew the first available adapter....any way to make it release renew on all possible adapters??

The majority of the code was a copy and paste from a few different sources and a little moronic tinkering on my end....im quite surprised it even works...


```
@echo off
:options
cls
echo =====================
echo MENU OPTIONS:
echo =====================
echo   1  ipconfig
echo   2  ipconfig all
echo   3  release
echo   4  renew
echo   5  flushdns
echo   6  reset winsock
echo   7  ping
echo   8  tracert
echo =====================
echo   q to quit
echo =====================
set /p input="Enter Options Here: "

if "%input%"=="1" goto:ipconfig
if "%input%"=="2" goto:ipconfigall
if "%input%"=="3" goto:release
if "%input%"=="4" goto:renew
if "%input%"=="5" goto:flushdns
if "%input%"=="6" goto:winsock
if "%input%"=="7" goto:ping
if "%input%"=="8" goto:tracert
if "%input%"=="q" goto:exit

echo Please choose from the Options listed above!
pause
goto:options

:ipconfig
ipconfig.exe
pause
goto:options


:ipconfigall
ipconfig.exe /all
pause
goto:options

:release
ipconfig.exe /release
pause
goto:options

:renew
ipconfig.exe /renew
pause
goto:options


:flushdns
ipconfig.exe /flushdns
pause
goto:options


:winsock
netsh winsock reset
pause
goto:options


:ping
ping yahoo.com
pause
goto:options


:tracert
tracert yahoo.com
pause
goto:options


:exit
exit
```


----------



## TheOutcaste (Aug 8, 2007)

You can put the color statement as the 2nd line in the file. This changes all text though, even what is already on the screen;, you can't have different text colors using Windows built in tools. For that you need a 3rd party tool, like Swiss File Knife.

As far as I know it displays a warning for adapters in the Media Disconnected state, but continues with the other adapters.
Here's what i get on XP with two adapters, with the first disconnected. The 2 connection still gets released and then renewed:

```
C:\Documents and Settings\TheOutcaste>ipconfig /release

Windows IP Configuration

No operation can be performed on Local Area Connection while it has its media disconnected.

Ethernet adapter Local Area Connection:

        Media State . . . . . . . . . . . : Media disconnected

Ethernet adapter Local Area Connection 2:

        Connection-specific DNS Suffix  . :
        IP Address. . . . . . . . . . . . : 0.0.0.0
        Subnet Mask . . . . . . . . . . . : 0.0.0.0
        Default Gateway . . . . . . . . . :

C:\Documents and Settings\TheOutcaste>ipconfig /renew

Windows IP Configuration

No operation can be performed on Local Area Connection while it has its media disconnected.

Ethernet adapter Local Area Connection:

        Media State . . . . . . . . . . . : Media disconnected

Ethernet adapter Local Area Connection 2:

        Connection-specific DNS Suffix  . : comcast.net
        IP Address. . . . . . . . . . . . : 192.168.9.206
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . : 192.168.9.5

C:\Documents and Settings\TheOutcaste>
```


----------



## squeezin (Mar 22, 2006)

Yep, thats exactly what i wanted to do...change all the text. Second line worked like a charm, Thanks.

As for my issue with my previous post " 2. When i run option 3 and 4, (release renew) it always says the "operation cannot be performed....media disconected" :

The code works like its supposed to for /release and /renew... For whatever reason the commands did not want to work before...but after a re-image, the code worked fine.

I think it may have been a little hiccup to do with windows 7 x64 SP1 .... i was playing around with the SP to see its quirks first hand. I was running that OS and build while trying the test the code... And after a little head bashing I said screw it and imaged my drive back to Pre-SP1 state. After that, the code worked perfect. Gonna try and install SP1 and see if i can replicate it to narrow it down to the sp1 update....

Ill post the results when my head trauma heals up 

Thanks again Outcaste


----------



## squeezin (Mar 22, 2006)

hmmmm, any suggestions on how to make that above batch file ( post 6 ) pop up as maximized?
ROFLMAO.... i cant wait to finally get some time to actually read into this basic scripting... Im sure ill laugh my butt off thinking how much time i spent thinking with only a few lines of code and creating batch file havoc for myself the last week.


----------



## Squashman (Apr 4, 2003)

To get the cmd window to launch maximized you would have to launch it from another batch file and use the code TheOutcaste gave you already to launch it.

As far as keeping your ipconfig output from scrolling off the screen just pipe the output to the more cmd.


----------



## squeezin (Mar 22, 2006)

I think i got it... sorta lol

came across the app called autosizer that works pretty well for similar stuff.

Anyways, thanks all !!!!


----------

