很简单:第一步:引用wsh对象,,,点击"工程"//// 引用 //// 勾选 windows script host object modle (位置比较靠下)第二步:添加一个按钮,复制下面的代码,运行即可:private sub command1_click()dim wshshell as new iwshruntimelibrary.wshshelldim mypcname as stringmypcname = wshshell.regread("hkey_local_machine\system\currentcontrolset\control\computername\computername\computername")wshshell.regwrite "hkey_local_machine\system\currentcontrolset\control\computername\activecomputername\computername", mypcnameend sub 20210311