Windows Forum / Windows Me / General Topics / February 2005
Computer Name
|
|
Thread rating:  |
CG - 22 Feb 2005 15:37 GMT I am creating a batch file that needs to determine the Computer Name before it runs. I have no problem with XP using "If %ComputerName% == xxxx. This statement does not work with ME. I have tried numerous strings. Is there a way to find the Computer Name? Thanks!
Galen - 22 Feb 2005 17:02 GMT > I am creating a batch file that needs to determine the Computer Name > before it runs. I have no problem with XP using "If %ComputerName% == > xxxx. This statement does not work with ME. I have tried numerous > strings. Is there a way to find the Computer Name? Thanks! That would be because Windows ME doesn't have a computername variable. I did a quick Google and came up with this site for you:
http://www.netopia.com/en-us/support/howtodocs/netoctopus/pmsi.html?print=yes
If you poke around on the site you'll find a computername.exe which you can download. That might do the trick for you. Doesn't appear to be anything that you need to pay for either. Of course I think that they're assuming that you've already installed their application in order to use it. Somehow my network to the ME box has gone a bit awry in the past day so I'm unable to download it while this PC is connected or I'd give it a shot and test it. If it doesn't work head back to a search engine and enter in add the %computername% variable to Windows ME.
Galen
 Signature "My mind rebels at stagnation. Give me problems, give me work, give me the most abstruse cryptogram or the most intricate analysis, and I am in my own proper atmosphere. I can dispense then with artificial stimulants. But I abhor the dull routine of existence. I crave for mental exaltation." -- Sherlock Holmes
heirloom - 22 Feb 2005 17:15 GMT Hey Galen, The computer's name is actually shown on the Identification tab of the Network applet. From that window you can change it to suit your fancy. Heirloom, old and gonna have company
> > I am creating a batch file that needs to determine the Computer Name > > before it runs. I have no problem with XP using "If %ComputerName% == [quoted text clipped - 3 lines] > That would be because Windows ME doesn't have a computername variable. I did > a quick Google and came up with this site for you: http://www.netopia.com/en-us/support/howtodocs/netoctopus/pmsi.html?print=yes
> If you poke around on the site you'll find a computername.exe which you can > download. That might do the trick for you. Doesn't appear to be anything [quoted text clipped - 6 lines] > > Galen Galen - 22 Feb 2005 18:00 GMT > Hey Galen, > The computer's name is actually shown on the Identification > tab of the Network applet. From that window you can change it to > suit your fancy. Heirloom, old and gonna > have company I thought that the OP wanted to know why the %computername% programming/scripting variable wouldn't function for them. The ability to do that is not native to Windows ME though %WinDir% is for example. A script to be used on multiple computers would benefit with the %computername% variable as it means the OP doesn't have to generate a custom script for each computer. If the OP wants to use the variable they'll need a third party tool to do it or I think that there might be a way to edit it in the registry but I usually try to avoid giving out advice about reg editing if I can help it. Perhaps I mis-understood what the OP was asking?
Galen
 Signature
"My mind rebels at stagnation. Give me problems, give me work, give me the most abstruse cryptogram or the most intricate analysis, and I am in my own proper atmosphere. I can dispense then with artificial stimulants. But I abhor the dull routine of existence. I crave for mental exaltation." -- Sherlock Holmes
heirloom - 22 Feb 2005 17:07 GMT http://newmanservices.com/vbwebdoc/ipaddr.htm The URL above will direct you to the computer's name and also provides info on how to change it. Heirloom, old and it's kinda like a dog with no legs, doesn't matter what you call it, it won't come anyway.
> I am creating a batch file that needs to determine the Computer Name before > it runs. I have no problem with XP using "If %ComputerName% == xxxx. This > statement does not work with ME. I have tried numerous strings. Is there a > way to find the Computer Name? Thanks! Mike M - 22 Feb 2005 17:23 GMT H,
The poster isn't asking how to change the computer name but rather for a method by which a computer's computer name can be checked when running a batch file. This can't be done with Win Me without the use of a third party uitility such as mentioned by Galen in his post.
 Signature Mike Maltby MS-MVP mike.maltby@gmail.com
> http://newmanservices.com/vbwebdoc/ipaddr.htm > The URL above will direct you to the computer's name and also > provides info on how to change it. David H. Lipman - 22 Feb 2005 17:27 GMT Intead of using DOS Batch file programming, try a real interpreter such as Kixstart { http://kixtart.org Kixtart is CareWare} and then you can use the readvalue() command to look in the Registry and you will find the computer name as in the script example below.
$PCName=readvalue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\Computer Name", "ComputerName") if ($PCName = "The_name_looked_for")=1 ; function to be performed endif
 Signature Dave
| I am creating a batch file that needs to determine the Computer Name before | it runs. I have no problem with XP using "If %ComputerName% == xxxx. This | statement does not work with ME. I have tried numerous strings. Is there a | way to find the Computer Name? Thanks! heirloom - 23 Feb 2005 04:08 GMT Sorry Galen and thanks Mike, 'Twas I that didn't read the OP's message properly. As usual, I stand corrected. Keep me straight, gentlemen.......I don't want to put out any bad skinny. Heirloom, old and bows to Galen & Mike
> Intead of using DOS Batch file programming, try a real interpreter such as Kixstart { > http://kixtart.org Kixtart is CareWare} and then you can use the readvalue() command to look > in the Registry and you will find the computer name as in the script example below. $PCName=readvalue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Compu terName\Computer
> Name", "ComputerName") > if ($PCName = "The_name_looked_for")=1 [quoted text clipped - 5 lines] > | statement does not work with ME. I have tried numerous strings. Is there a > | way to find the Computer Name? Thanks! Galen - 23 Feb 2005 05:25 GMT > I don't want to > put out any bad skinny. Forgive my youth (only 31) and being an American but I have to ask... What is a "bad skinny" and is it something I can catch from swapping body fluids? *chuckles*
Galen
 Signature
"My mind rebels at stagnation. Give me problems, give me work, give me the most abstruse cryptogram or the most intricate analysis, and I am in my own proper atmosphere. I can dispense then with artificial stimulants. But I abhor the dull routine of existence. I crave for mental exaltation." -- Sherlock Holmes
heirloom - 23 Feb 2005 05:52 GMT LOL. I don't remember where I picked that up and I, too, am an American, even worse, a Texan, by virtue of homestead. "Skinny" is a colloquial term for 'information'..........for example: "I'll give you the whole skinny later." Don't you have this warm feeling of enlightenment now? Heirloom, old and not so skinny
> > I don't want to > > put out any bad skinny. [quoted text clipped - 4 lines] > > Galen Galen - 23 Feb 2005 08:14 GMT > LOL. I don't remember where I picked that up and I, too, am an > American, even worse, a Texan, by virtue of homestead. "Skinny" is > a colloquial term for 'information'..........for example: "I'll give > you the whole skinny later." Don't you have this warm feeling of > enlightenment now? Heirloom, old and not so > skinny Alas, I'm in Maine... Thus I'm not certain if it's enlightenment or Nyquil because I have a cold. Either way I certainly have the warm feeling in my belly. I seem to recall "Give me the skinny" in an old black and white movie, James Carrey (spelling) perhaps? I'm not that big of a movie buff but it sounds vaguely familiar and now that I think about it I might have heard it in an old cartoon. Guess it's the generation gap thing. Then again, I was completely lost when someone said something about shiznit and I was pretty close to irate when someone called me "Dawg" (or is it Dog???) the first time when I was out in California last. I guess there's a new generation gap or perhaps by the time slang reaches Maine it's already too late to use it.
Galen
 Signature "My mind rebels at stagnation. Give me problems, give me work, give me the most abstruse cryptogram or the most intricate analysis, and I am in my own proper atmosphere. I can dispense then with artificial stimulants. But I abhor the dull routine of existence. I crave for mental exaltation." -- Sherlock Holmes
Justin Thyme - 23 Feb 2005 19:23 GMT > > LOL. I don't remember where I picked that up and I, too, am an > > American, even worse, a Texan, by virtue of homestead. "Skinny" is [quoted text clipped - 15 lines] > > Galen Please excuse my breaking in here to your discussion but slang has fascinated me for many years (I recently tried to find the origin of "worrywort" or, alternatively, "worrywart," with little success). About "skinny," if you are interested in pursuing this any farther, go here:
http://www.phrases.org.uk/bulletin_board/17/messages/74.html
where you'll find essentially what Heirloom has already said.
Ken Bland
heirloom - 24 Feb 2005 00:06 GMT Thanks, Ken, now we all have the real skinny. Heirloom, old and shiznit worries me
> > > LOL. I don't remember where I picked that up and I, too, am an > > > American, even worse, a Texan, by virtue of homestead. "Skinny" is [quoted text clipped - 31 lines] > > Ken Bland heirloom - 24 Feb 2005 00:03 GMT I think that would have been James "Cagney"......and I think you are correct. Now you have to enlighten me about "shiznit".........sounds like a Jewish swear word. (if anyone here is Jewish, it's a joke......har........no offense intended). BTW, I loved the "first time I visited California last." Heirloom, old and thinks Imodium will cure the shiznits.
> > LOL. I don't remember where I picked that up and I, too, am an > > American, even worse, a Texan, by virtue of homestead. "Skinny" is [quoted text clipped - 15 lines] > > Galen David H. Lipman - 24 Feb 2005 01:05 GMT http://www.urbandictionary.com/define.php?term=shiznit
http://www.brendonwilson.com/profile/000129.shtml
BTW: It does sound like Yiddish, oy yey ;-)
 Signature Dave
| I think that would have been James "Cagney"......and I think you are | correct. Now you have to enlighten me about "shiznit".........sounds like a [quoted text clipped - 28 lines] | > | > Galen heirloom - 24 Feb 2005 01:38 GMT I'm in no way Yiddish, but, shouldn't that have been "oy vey?" Either way, it's the shiznit! In the words of the famous Paul Harvey, "....and now you know the rest of the skinny." Heirloom, old and something ain't quite right.
BTW, I will be holding Mr. Jack Martinelli, MS-MVP, hostage, starting Friday morning. If anyone would like to contribute to his release fund...post back here. <g> Gonna keep him on a diet of cheap Texas wine and chili......talk about a pressurized cabin on his flight home!
> http://www.urbandictionary.com/define.php?term=shiznit > [quoted text clipped - 34 lines] > | > > | > Galen David H. Lipman - 24 Feb 2005 02:13 GMT Yepper -- Typo city, I meant Oy vey ;-)
 Signature Dave
| I'm in no way Yiddish, but, shouldn't that have been "oy vey?" Either way, | it's the shiznit! In the words of the famous Paul Harvey, "....and now you [quoted text clipped - 5 lines] | here. <g> Gonna keep him on a diet of cheap Texas wine and chili......talk | about a pressurized cabin on his flight home! heirloom - 24 Feb 2005 04:34 GMT What??......no offerings for the release of Mr. Martinelli???? Heirloom, old and may have to make more chili
> Yepper -- Typo city, I meant Oy vey ;-) > [quoted text clipped - 7 lines] > | here. <g> Gonna keep him on a diet of cheap Texas wine and chili......talk > | about a pressurized cabin on his flight home! Noel Paton - 24 Feb 2005 06:57 GMT If you're feeding him chilli then he doesn't need a release fund - just a back-blast protector!
 Signature Noel Paton (MS-MVP 2002-2005, Windows)
Nil Carborundum Illegitemi http://www.btinternet.com/~winnoel/millsrpch.htm http://tinyurl.com/6oztj
Please read http://dts-l.org/goodpost.htm on how to post messages to NG's
> What??......no offerings for the release of Mr. Martinelli???? > Heirloom, old and may have to make more chili [quoted text clipped - 16 lines] > chili......talk >> | about a pressurized cabin on his flight home! Joan Archer - 24 Feb 2005 09:39 GMT <lol> And he could probably propel himself home without the need for an aeroplane <g> Joan
> If you're feeding him chilli then he doesn't need a release fund - just a > back-blast protector! CG - 23 Feb 2005 19:09 GMT Everyone,
Solved the problem by using Kixtart. After a bit of time to correct script errors, I was able to "read" the pc name and use it in an "IF" statement. Thanks for all the info everyone.
> Intead of using DOS Batch file programming, try a real interpreter such as Kixstart { > http://kixtart.org Kixtart is CareWare} and then you can use the readvalue() command to look [quoted text clipped - 10 lines] > | statement does not work with ME. I have tried numerous strings. Is there a > | way to find the Computer Name? Thanks! David H. Lipman - 23 Feb 2005 20:06 GMT C O O L !
I think you'll find it is a great interpreter and useful in *many* ways.
 Signature Dave
| Everyone, | [quoted text clipped - 5 lines] | > http://kixtart.org Kixtart is CareWare} and then you can use the readvalue() command to look | > in the Registry and you will find the computer name as in the script example below. $PCName=readvalue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\Computer
| > Name", "ComputerName") | > if ($PCName = "The_name_looked_for")=1 [quoted text clipped - 5 lines] | > | statement does not work with ME. I have tried numerous strings. Is there a | > | way to find the Computer Name? Thanks! Shane - 24 Feb 2005 02:06 GMT > I am creating a batch file that needs to determine the Computer Name before > it runs. I have no problem with XP using "If %ComputerName% == xxxx. This > statement does not work with ME. I have tried numerous strings. Is there a > way to find the Computer Name? Thanks! Assuming you want to find a match, as implied by *"If %ComputerName% == xxxx*, then you can do on these lines:
-------------------------------------------------
@ECHO OFF CLS
IF "%OS%"=="WINDOWS_NT" goto nt_section
REGEDIT /E regtest.tmp "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName" find "1st_comp_name_here" regtest.tmp if errorlevel==1 goto next1 cls pause goto end
:next1 find "2nd_comp_name_here" regtest.tmp if errorlevel==1 goto next2 cls pause goto end
:next2 find "3rd_comp_name_here" regtest.tmp if errorlevel==1 goto last1 cls pause goto end
:nt_section If not "%ComputerName%" == "4th_comp_name_here" goto last1 cls pause goto end
:last1 cls echo. echo Hmm, crapped out, I see! echo. pause goto end
:end del c:\*.tmp CLS EXIT CLS
--------------------------------------------------
Shane
Shane - 24 Feb 2005 02:12 GMT > REGEDIT /E regtest.tmp > "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName" This wrapped and should be one line.
Shane
heirloom - 24 Feb 2005 04:35 GMT I'm impressed. Heirloom, old and easily amused
> > REGEDIT /E regtest.tmp > > "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName" > > This wrapped and should be one line. > > Shane Shane - 24 Feb 2005 05:26 GMT Here's a slightly more economical version. Remembering that
regedit /e regtest.tmp "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName"
should be on one line, run the batch as is and you'll get the *crapped out* message. Replace *2nd_comp_name_here* with your own computer name and you'll see it works. Whatever the batch is supposed to do on the correct machine, you just replace *find /i "=" regtest.tmp* with the appropriate command. It'll work whether 98/ME or NT/XP.
Actually I'm fairly sure the regedit /e would also work on NT/XP so there's no need for a seperate section (wrong machine right now to test it. You can certainly merge reg files using regedit /s in either kernel).
Of course, it's no good if you want to get an unknown computer name from the registry and put it into a variable, but afaics one is supposed to know the possible computer names in advance.
-----------------------------------
@echo off cls if "%OS%"=="WINDOWS_NT" goto nt_section regedit /e regtest.tmp "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName" find /i "1st_comp_name_here" regtest.tmp if errorlevel==1 goto next1 goto action
:next1 find /i "2nd_comp_name_here" regtest.tmp if errorlevel==1 goto last goto action
:nt_section If not "%ComputerName%"=="1st_comp_name_here" goto next2 goto action
:next2 If not "%ComputerName%"=="2nd_comp_name_here" goto last goto action
:last cls echo. echo Hmm, crapped out, I see! pause>nul goto end
:action cls find /i "=" regtest.tmp pause>nul
:end del *.tmp cls exit cls
------------------------
Shane
Shane - 28 Feb 2005 02:39 GMT Tried this batch on my XP Home and it didn't work as is. Apparently %OS% is case sensitive, so it works with "Windows_NT" but not all uppercase. And I don't have a %ComputerName% variable, I have %UserDomain%. Appropriate changes and it works, but then the 9x method also works, so the nt_section section is redundant.
Shane
> Here's a slightly more economical version. Remembering that > [quoted text clipped - 54 lines] > > Shane
|
|
|