Lệnh NET được sử dụng để quản lý các service như sau:
Nội dung bài viết
Cú pháp
NET START [service] NET STOP [service] NET PAUSE [service] NET CONTINUE [service]
service: Tên dịch vụ như được hiển thị trong Control Panel, Services
Ví dụ Lệnh NET trong CMD
Liệt kê danh sách các services:
NET HELP SERVICES
Liệt kê danh sách các service đang chạy
NET START
Dừng service bộ đệm in và nếu thành công, hãy khởi động lại nó:
NET STOP spooler && NET START spooler
Để sử dụng tên dịch vụ dài, hãy đặt tên dịch vụ đó bằng dấu ngoặc kép:
NET STOP "Chiasezui Listener"
Error/return codes
Không giống như SC , lệnh NET không trả về mã class Win32_Service (Service Not Active, Service Request Timeout, v.v.) và đối với nhiều lỗi sẽ trả về Errorlevel 2.
Nó sẽ in ra các lỗi của chính nó trên màn hình:
"The service table is locked. More help is available by typing NET HELPMSG 2180"
"The service table is full. More help is available by typing NET HELPMSG 2181"
"The requested service has already been started. More help is available by typing NET HELPMSG 2182"
"The service name is invalid. More help is available by typing NET HELPMSG 2185"
"The service is not responding to the control function. NET HELPMSG 2186"
"The service control is busy. NET HELPMSG 2187"
"Invalid service program name. NET HELPMSG 2188"
"The service could not be controlled in its present state. More help is available by typing NET HELPMSG 2189"
"The service ended abnormally. More help is available by typing NET HELPMSG 2190"
"The requested pause or stop is not valid for this service. More help is available by typing NET HELPMSG 2191"
"could not find service name. More help is available by typing NET HELPMSG 2192"
"service control dispatcher pipe read failed. More help is available by typing NET HELPMSG 2193"
"A thread for the new service could not be created. More help is available by typing NET HELPMSG 2194"
Bạn có thể phát hiện các lỗi này bằng cách tìm kiếm văn bản đầu ra bằng lệnh FIND như sau:
NET START alerter 2>&1|FIND "2182"
IF errorlevel 1 goto :sub_already_started
Xem thêm:
- Cách tạo file rỗng trong Windows Command Prompt
- Đặt Lịch Backups Tự Động Google Sheets Cập Nhật mới nhất
- Command thay thế space thành tab trong linux
Nếu bạn thấy bài viết hữu ích, xin hãy đánh giá ở đây:
[Total: 0 Average: 0]
Leave a Reply