Batch files

greenfreak

New Member
It's been a while since I've done a batch file.

I want it to release/renew the IP address of the computer but I don't want my user to see it running. I thought the command to hide the window was @echo off but each time I do it, I see the window. This is what the file looks like:

@echo off
ipconfig /release
ipconfig /renew


I mean, this is supposed to be simple, right?? :) If I can't get it to run without them seeing it, I'd at least like to run minimized so it just shows on the taskbar.

Any thoughts?
 
Right click on the batch file and go to properties, I think the settings you are looking for are in there now.
 
I attached a screenshot of the properties of the batch file. I don't see any of the options you were talking about...

I thought to run a batch file without opening a window, or minimized, there were commands you had to enter in the file itself. Does anyone know what they are?

I think I'm going to have to break out my old DOS notebook.
 
Shit, you're right, I'm pretty sure they used to be that way, but 2k doesn't have any of those options now.
 
So basically even if I get the batch file right in a 98 machine, if it's run on Windows 2000, those commands aren't going to mean much, huh? That would explain why @echo off does nothing to the file.:grumpy:
 
There may still be batch file commands that do it, it's just been about 10 years since I've written a batch file of any significance, and am suffering form CRS right now. I'm pretty sure in 98, the options used to be in properties.
 
Actually, that site was quite helpful. There's nothing else I need to do with the batch file itself, except try to figure out how to hide it. If my users see it, they'll X out of it.

There's a guy at work who's our guru and he uses batch files frequently, I'll ask him about it tomorrow. I like it when he thinks I know what I'm doing so I don't like asking too many questions. :D
 
done, the application will do this

ipconfig /release
ipconfig /renew

and then close itself.

It will only work if ipconfig path is in the PATH enviroment variable, which is the common case.


It should work flawlessly.
 
ouch, i missed the "hide" part, lemme see if i can hide the window.
 
Posty, I took those links and put them in my favorites--they look interesting! The only reason why I couldn't do it here for everyone is because we have many people still running Windows 95 and 98. But I just love playing with new stuff anyway. :D

Luis, wow. I don't know how you did that but I'd really like to know. It works, of course! This is going to be beta tested by one branch so we'll see if there's any problem with the Path then.

Please let us in on it and thanks!! :D
 
Just a few lines of C code.

Code:
	WinExec("ipconfig /release",SW_HIDE );
	WinExec("ipconfig /renew",SW_HIDE);

	OnOK();

I added that portion of the code in the constructor of the dialog box, it should not even display the dialog, since the call to "OnOK" exits the program before the window is drawed.
 
btw, sorry for the "bloated" program, i could have made it smaller but i had a problem when i was trying to include the winbase.h header, so i decided just to create an MFC application.
 
omg, I have no idea what you just said. :laugh: I don't know C so I guess I'm out of luck on understanding it... But hey, if it works, I'm using it!! Thanks again Luis!
 
Back
Top