![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-27 00:34 |
47,812 topics / 349,912 posts / today 2 new / 48,264 members |
| 其它操作系统综合讨论区 » Ask about the CMD command to display the computer name... |
| Printable Version 2,101 / 9 |
| Floor1 Mnyoll | Posted 2008-11-14 11:17 |
| 初级用户 Posts 32 Credits 75 | |
|
Been looking for a long time and didn't find it.....
Want to use the NETSTAT command but it's too slow.... Come to ask for advice... Moved from DOS Learning Introduction & Wonderful Articles (Teaching Room) Clearly posted in the wrong section. Since it's a new forum user, no deduction is given for now, but the registration time is also over a year, so you should be familiar with the forum. Please pay attention in the future. ——Administrator |
|
| Floor2 Mnyoll | Posted 2008-11-14 12:11 |
| 初级用户 Posts 32 Credits 75 | |
|
This is like this....
We know that in PUBWIN there are processes named after the local computer name.... For example, if the computer name is A001, its process is A001.exe.... If the computer name is A002, its process is A002.exe I now want to use BAT to kill this process... Which big brother can help??? |
|
| Floor3 yishanju | Posted 2008-11-21 18:24 |
| 银牌会员 Posts 1,357 Credits 1,488 | |
|
Uh, the administrator has moved the post to the wrong section and is still criticizing others.
|
|
| Floor4 yishanju | Posted 2008-11-21 18:36 |
| 银牌会员 Posts 1,357 Credits 1,488 | |
|
IPCONFIG /ALL
The host name is followed by the computer name |
|
| Floor5 yishanju | Posted 2008-11-21 18:42 |
| 银牌会员 Posts 1,357 Credits 1,488 | |
|
The system itself has a variable %computername% representing the computer name
echo %computername% |
|
| Floor6 yishanju | Posted 2008-11-21 19:22 |
| 银牌会员 Posts 1,357 Credits 1,488 | |
|
I just now discovered that the hostname.exe command can also display the computer name
|
|
| Floor7 DOSroot | Posted 2008-11-21 20:14 |
| 管理员 Posts 198 Credits 389 | |
Originally posted by yishanju at 2008-11-21 18:24: Then what do you think it should be moved to? |
|
| Floor8 HAT | Posted 2008-11-23 12:41 |
| 版主 Posts 5,017 Credits 9,023 | |
|
```@echo off
for /f "skip=4 delims=" %%a in ('reg query HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName /v ComputerName') do ( set pcName=%%a ) set pcName=%pcName:~24% echo %pcName% ``` |
|
| Floor9 HAT | Posted 2008-11-23 12:41 |
| 版主 Posts 5,017 Credits 9,023 | |
|
```
@echo off for /f "tokens=2 delims==" %%a in ('wmic computersystem get name') do ( set pcName=%%a ) echo %pcName% ``` |
|
| Floor10 HAT | Posted 2008-11-23 12:44 |
| 版主 Posts 5,017 Credits 9,023 | |
|
```
@echo off for /f "tokens=2 delims=\" %%a in ('net config server') do ( set pcName=%%a ) echo %pcName% ``` |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |