Batch-processing version of the Sc_dos/bat

Source: Internet
Author: User
Tags goto
Author: netpatch
Source: Evil Octal China

Description
Batch version--sc

First of all, thanks to zzzevazzz, this batch of procedures is based on his release of the "Do All in Cmd Shell" in the text of the written!
The principle is based on the function of the INF file (for more information on the INF file, you can refer to the DDK Help document.) ) to be automated and written!
The difficulty is very low, I only spent 10 minutes to write out this batch of procedures. (The master saw not laugh oh ...) )

Specific usage:

The installation service syntax is:
NP Service name/A service Display Name Service description Startup Type the program address to add as a service
Example:
For example, I want to install a service named Test with the display name: This is Test service description: Experimentation
The program path to add as a service is the C:\winnt\system32\test.exe Startup type: Automatic and start immediately after installation

First, Test.exe copy to c:\winnt\system32\.
Then execute:
NP test/a "This is test" experimentation 2 c:\winnt\system32\test.exe/s
It will automatically install Test.exe as service and start immediately after execution!

Uninstall Service Syntax:
For example, to uninstall a service with the service name test
The
NP text/x
You can enter after

Note: Cheng that only install does not start immediately! Unless you add the/s parameter behind it, it will start immediately after installation!

Please do not use this procedure for illegal use! Otherwise, the consequences are entirely in the users ' charge!
Welcome Reprint!
To reprint, please keep the content intact! Thank you!

Attached: Batch Content

Copy Code code as follows:
_content> @echo off
Cls
Color F2
: Go
If "%1" = "" goto use
If "%2" = "" goto use
If "%2" = = "/a" goto AZ
If "%2" = = "/x" goto XZ
: AZ
If "%5" = "" goto use
If "%6" = "" goto use
echo [Version] >c:\az.inf
echo signature= "$WINDOWS nt$" >>c:\az.inf
echo [Defaultinstall.services] >>c:\az.inf
Echo Addservice=%1,,my_addservice_name >>c:\az.inf
echo [My_addservice_name] >>c:\az.inf
Echo displayname=%3 >>c:\az.inf
Echo description=%4 >>c:\az.inf
Echo servicetype=0x10 >>c:\az.inf
Echo starttype=%5 >>c:\az.inf
Echo errorcontrol=0 >>c:\az.inf
Echo servicebinary=%6 >>c:\az.inf
rundll32.exe setupapi,installhinfsection DefaultInstall 128 C:\az.inf
Del C:\az.inf
If "%7" = "" Goto exit
If "%7" = = "/S" net start%1
Goto exit
: XZ
NET Start|find '%1 ' >nul&&net stop%1
echo [Version] >c:\xz.inf
echo signature= "$WINDOWS nt$" >>c:\xz.inf
echo [Defaultinstall.services] >>c:\xz.inf
Echo delservice=%1 >>c:\xz.inf
rundll32.exe setupapi,installhinfsection DefaultInstall 128 C:\xz.inf
Del C:\xz.inf
Goto exit
: Use
Echo ******************************************************************************
echo * * Installation Service Batch program * *
echo * * *
echo * * Installation Example: * *
echo * * *
echo * NP service name/A service Display Name Service description Startup Type the program address to add as a service * *
echo * * Startup type: 0 system boot load, 1 OS initialization load * *
echo * * 2 is started automatically by the SCM (Service Control Manager), 3 manually, and 4 disabled. **
echo * * *
echo * * Uninstall Example: * *
echo * * *
echo * NP Service name/x * *
echo * * *
Echo * * Build by Netpatch (n/p) qq:251592982 * *
echo * * 2005-4-07 * *
Echo ******************************************************************************
cmd/k
: Exit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.