Author Topic: letter case in Computer Name  (Read 5821 times)

0 Members and 1 Guest are viewing this topic.

MeasureUp

  • Bull Frog
  • Posts: 462
letter case in Computer Name
« on: November 26, 2012, 06:38:07 PM »
I set my computer name as "WorkStation_05".
It can be found in control panel -> System.
But (getenv "computername") returns as "WORKSTATION_05".
How can I get the variable as "WorkStation_05" without it all in upper case?

Thanks for your help.

MeasureUp

  • Bull Frog
  • Posts: 462
Re: letter case in Computer Name
« Reply #1 on: November 26, 2012, 09:25:36 PM »
I think this is something on the windows setting.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: letter case in Computer Name
« Reply #2 on: November 27, 2012, 12:30:32 AM »
I think this is something on the windows setting.
That's probably correct. There might be some other registry code showing the name with lower case letters as well. You could try searching for such through RegEdit.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

ronjonp

  • Needs a day job
  • Posts: 7527
Re: letter case in Computer Name
« Reply #3 on: November 27, 2012, 10:19:19 AM »
What does this return:
Code - Auto/Visual Lisp: [Select]
  1. (vlax-get (vlax-get-or-create-object "WScript.Network") 'computername)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

MeasureUp

  • Bull Frog
  • Posts: 462
Re: letter case in Computer Name
« Reply #4 on: November 27, 2012, 05:44:06 PM »
To ronjonp:
It returns the computer name with all upper case letters.

To irneb:
Sorry, I turned on the "regedit" dialog box but I know nothing about searching registry.

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: letter case in Computer Name
« Reply #5 on: November 27, 2012, 06:02:30 PM »
The Computer Name is found in the registry under:

Code: [Select]
HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ComputerName
However, I am unsure where the lower-case version (as displayed in the System Properties) is found, if indeed it resides in the registry at all... :|

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: letter case in Computer Name
« Reply #7 on: November 27, 2012, 06:32:15 PM »
After a quick search on Google, I stumbled across this thread:

http://www.quickmacros.com/forum/viewtopic.php?f=1&t=5256

Which appears to indicate that the use of this function:

http://msdn.microsoft.com/en-gb/library/windows/desktop/ms724301%28v=vs.85%29.aspx

yields the desired lowercase result.

And since the MSDN documentation states:
Quote
The names are established at system startup, when the system reads them from the registry.

This seems to confirm that the values are indeed stored somewhere in the registry, but I have no clue where... maybe someone else can carry the baton from here.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: letter case in Computer Name
« Reply #8 on: November 27, 2012, 11:24:17 PM »
To irneb:
Sorry, I turned on the "regedit" dialog box but I know nothing about searching registry.
Sorry, none of my PC's/Laptops have lowercase letters in their names - so I can't actually search myself.
 
While you've got the RegEdit (Registry Editor) open, click Edit --> Find ... (or Ctrl+F). Type the computer's name & click OK. Press F3 to continue the search until you find a key with the lowercase letters, then note the path listed in RegEdit's status bar (you can also right-click on a key in the tree on the left then "Copy Key Name" - gives the full path).
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

MeasureUp

  • Bull Frog
  • Posts: 462
Re: letter case in Computer Name
« Reply #9 on: November 27, 2012, 11:50:31 PM »
To irneb,
Thank you again.
I've just done something before reading your post.

These are what I've done:
Code: [Select]
1) (setenv "computername" "WorkStation_05")
2) (setenv "setcomputername" "WorkStation_05")

I have to change 2 env variables because if the value of one of them doesn't affect the other.
And it works perfectly!

And certainly thanks to Lee Mac and other guys who gave their tips.