China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-26 23:35
中国DOS联盟论坛 » 其它操作系统综合讨论区 » Ask about the CMD command to display the computer name... View 2,099 Replies 9
Original Poster Posted 2008-11-14 11:17 ·  中国 广东 汕头 电信
初级用户
Credits 75
Posts 32
Joined 2007-06-11 23:35
19-year member
UID 91018
Gender Male
Status Offline
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
学习中
Floor 2 Posted 2008-11-14 12:11 ·  中国 广东 汕头 电信
初级用户
Credits 75
Posts 32
Joined 2007-06-11 23:35
19-year member
UID 91018
Gender Male
Status Offline
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???
学习中
Floor 3 Posted 2008-11-21 18:24 ·  中国 北京 鹏博士长城宽带
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
Uh, the administrator has moved the post to the wrong section and is still criticizing others.

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 4 Posted 2008-11-21 18:36 ·  中国 北京 鹏博士长城宽带
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
IPCONFIG /ALL

The host name is followed by the computer name

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 5 Posted 2008-11-21 18:42 ·  中国 北京 鹏博士长城宽带
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
The system itself has a variable %computername% representing the computer name

echo %computername%

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 6 Posted 2008-11-21 19:22 ·  中国 北京 鹏博士长城宽带
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
I just now discovered that the hostname.exe command can also display the computer name

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 7 Posted 2008-11-21 20:14 ·  中国 上海 电信
管理员
★★
Credits 389
Posts 198
Joined 2008-09-23 12:00
17-year member
UID 126405
Gender Male
Status Offline
Originally posted by yishanju at 2008-11-21 18:24:
Well, the administrator also moved the post to the wrong section, and then blamed others

Then what do you think it should be moved to?
Floor 8 Posted 2008-11-23 12:41 ·  美国 惠普HP
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
```@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%
```
Floor 9 Posted 2008-11-23 12:41 ·  美国 惠普HP
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
```
@echo off
for /f "tokens=2 delims==" %%a in ('wmic computersystem get name') do (
set pcName=%%a
)
echo %pcName%
```
Floor 10 Posted 2008-11-23 12:44 ·  美国 惠普HP
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
```
@echo off
for /f "tokens=2 delims=\" %%a in ('net config server') do (
set pcName=%%a
)
echo %pcName%
```
Forum Jump: