I'm making a simple batch file (bat) how do I make it stay open?

superHARD

Diamond Member
Jul 24, 2003
7,828
1
0
so I have a bat file that has "ipconfig /all" in it, but when I run it, it just closes...how do I make it stay open? Is there a command for this or something? It needs to be fixed in the bat file, not in the OS, I will be sending it to people to tell me their MAC addresses.
 

superHARD

Diamond Member
Jul 24, 2003
7,828
1
0
TY dude you rock!

now is there a way to make it auto copy to clipboard their mac address?
 

Snapster

Diamond Member
Oct 14, 2001
3,916
0
0
Not sure you can do that. You could actually just output the result to a text file and get them to send that to you.

@echo off

ipconfig /all > c:\ipresult.txt

pause
 

superHARD

Diamond Member
Jul 24, 2003
7,828
1
0
any way to auto put that in a email?

or any to copy the txt file so all they have to do is paste it in a email back to me?
 

Snapster

Diamond Member
Oct 14, 2001
3,916
0
0
The problem is that I don't think batch files do not have access to the clipboard. You can do a mailto launch within a batch file, but you can't set the body to anything other than a string, but then you'd need to set that string to the result of the command which is a tad long :)

I think it's just asking a little bit too much automation from a simple script, you need a more complex scripting language or your own program to do what you want.

Then again, batch guru's could well prove me wrong. :)
 

Snapster

Diamond Member
Oct 14, 2001
3,916
0
0
Pretty much like html:


START mailto:help@yourdomain.com?subject=Your%%20subject%%

It'll spawn a new mail from the default mail client
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,615
4,532
75
Hey, that start is pretty cool. :cool:

If all you're after is the MAC addresses, and not what interfaces they go to, the data could be made shorter:

ipconfig /all | find "Physical Address" > c:\ipresult.txt

But I'm not sure how to get that into the Subject line. :(
 

superHARD

Diamond Member
Jul 24, 2003
7,828
1
0
Cool, the find feature workes great for me...TY!

Now, how do I automate a "run as" command in there?
I'm wanting to run it as a certian username in this case the username is "install"
 

superHARD

Diamond Member
Jul 24, 2003
7,828
1
0
Originally posted by: yinan
You can gather this information remotely using vbscript and wmi

I don't know how to use either of them...and I don't really know how to use these bat files either... :(
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
Originally posted by: superHARD
Cool, the find feature workes great for me...TY!

Now, how do I automate a "run as" command in there?
I'm wanting to run it as a certian username in this case the username is "install"

runas /username:yourdomain\install yourcommand

There are other options to consider, but that should be enough to get you started.
 

nweaver

Diamond Member
Jan 21, 2001
6,813
1
0
do you know their IP already?

If so, use psexec command, psexec ipconfig /all \\computernameorip /user:install

the syntax may be off (it's been a while since I had to bust out the pstools) but it should be close.
 

exdeath

Lifer
Jan 29, 2004
13,679
10
81
You can do anything in a batch file that you can do in Windows API by calling rundll32.

For example try this from the command line:

rundll32 user32.dll LockWorkStation