Command Line Questions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dear All,
I had 2 questions about using the command line within Windows XP to stream
line support functions. I am trying to write some batch files but have
encountered the following problems, that I was hoping that someone would be
able to help me with:
1 - I'm trying to test through a command line in an if statement if a
computer that I am trying to connect to is on. I thought of using a ping
command and then trying to rip the "Recieved" packet number out of the
output, then if that number is greater than 0 the computer is turned on. But,
here in lies the problem, I'm trying to do that using the FOR /F command but
given that a ping can output up to 8 lines of text, does anyone know how I
could delimit the output by carridge return / line feed to break the output
up into each line, then I can rip the recieved packet value out of the
string. Or is there a simpler way of testing whether a computer is powered on
through the command line?
2- My second question was is there a command line switch for Computer
management (%SystemRoot%\system32\compmgmt.msc) that I could use to connect
automatically to a remote network computer? It seems like a simple thing to
do, but I haven't been able to find any directions either on Microsoft.com or
Google.
Thank you for your learned advice in advance.
Sam Horwood
 
For the first, you could use IFEXIST and look for a network share on the remote computer. I "think" IFEXIST is supported in BAT files. If not, it certainly is in VB Scripts.

And there are no command line options for COMPMGMT.MSC that I'm aware of.
 
Back
Top