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-04 15:22
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Batch script to end processes View 2,150 Replies 6
Original Poster Posted 2007-05-11 15:00 ·  中国 上海 杨浦区 电信
初级用户
Credits 45
Posts 22
Joined 2006-03-11 23:47
20-year member
UID 51842
Status Offline

─────────────────── Moderation Record ────────────────────
Executor: bjsh
Original Title: Novice hopes for experts' guidance
Description: Because the title is too vague, it is not convenient for forum search and management. Please modify the title within three days.
Prompt: To modify the title, click Edit at the bottom right of the current post, and then click Edit Post after modification.
Punishment: Since it is a new forum user, no punishment is temporarily given; if the title is not modified within three days, 2 points will be deducted as punishment, and the moderator will forcefully modify the title. Please click here to read the forum posting regulations or view The Wisdom of Asking Questions to avoid violating posting regulations in future discussions.
─────────────────── Moderation Record ────────────────────



This is a batch script I downloaded in the forum. For novices like me, I really hope experts can help us interpret it, so that I can learn faster than reading those boring commands. Please also ask all experts to be generous with your advice
@echo off --------------- I've mixed this up for a long time and know what it means, which is not to display the command itself
:1 -------------------------- Don't understand
title End Process ----------- The title of cmd
color f1 -------------------- The background color of the script
mode con: cols=40 lines=18 --- I guess it's the size of the window!
echo. ------------- Why is there a dot at the end
set /p run=Please enter the program name to end -------- Please can you introduce it in detail
::ntsd -c q -pn %run% ------------- What does :: mean in front of the command
taskkill /f /t /im %run% -------------- I know what this command means but don't know when connected with the front
pause>nul
I would like to thank you here first :)

[ Last edited by daoshui18 on 2007-5-11 at 04:23 PM ]
Floor 2 Posted 2007-05-11 15:09 ·  中国 四川 绵阳 江油市 电信
高级用户
★★★
Credits 502
Posts 327
Joined 2006-12-30 06:01
19-year member
UID 74981
Gender Male
Status Offline
echo. -----------Blank line in the window
This P is actually a sentence: taskkill /f /t /im %run%---------Kill the process of %ren%
It can also be forced to end with ntsd -c q -pn %run% ------------------Please enter ntsd /? in cmd
set /p run=Please enter the program name to end ---------------------Enter set /? in cmd

Declaration: I am not an expert, I have just been lurking in the forum for half a year, please forgive me for any details
Floor 3 Posted 2007-05-11 15:18 ·  中国 浙江 杭州 华数宽带
银牌会员
★★★
Credits 2,000
Posts 621
Joined 2007-01-01 00:00
19-year member
UID 75212
Gender Male
Status Offline
: :1 --------------------------Don't understand
It's a label;
Often used with goto and call;
To achieve program jumping or similar function of functions;

Output blank line: echo.

set /p run=Please enter the program name to end
It's the usage of set;
set /p variable name=prompt string
It's to output the prompt string and ask the user to input;
And assign the input to the variable name;
Describe in C language:
Equivalent to:
printf ("prompt string");
scanf("void",&variable name);
Void represents any data type; because there is no distinction of data types under cmd;

:: means comment; same as rem
Floor 4 Posted 2007-05-11 16:24 ·  中国 上海 杨浦区 电信
初级用户
Credits 45
Posts 22
Joined 2006-03-11 23:47
20-year member
UID 51842
Status Offline
Moderator, I've made changes. Thanks a lot. Could you send me some materials about `set`? What I found on Baidu is always unclear. Haha
Floor 5 Posted 2007-05-11 16:25 ·  中国 上海 杨浦区 电信
初级用户
Credits 45
Posts 22
Joined 2006-03-11 23:47
20-year member
UID 51842
Status Offline
Thanks to the enthusiastic experts, I'm very motivated!
Floor 6 Posted 2007-05-11 16:42 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
Originally posted by daoshui18 at 2007-5-11 16:24:
Moderator, I have made changes, thank you.
Can you send me some materials about set? What I find on Baidu is always unclear, haha

You need to learn to search by yourself~

http://www.cn-dos.net/forum/search.php?searchid=110022&orderby=lastpost&ascdesc=desc&searchsubmit=yes&sid=0UJaRC
Floor 7 Posted 2007-05-11 17:11 ·  中国 上海 杨浦区 电信
初级用户
Credits 45
Posts 22
Joined 2006-03-11 23:47
20-year member
UID 51842
Status Offline
Forum Jump: