Install Windows Service Using bat

Source: Internet
Author: User
Tags dropbox windows

The script is as follows:

@echo off

@setlocal enableextensions @cd/d "%~dp0"

Set Installpath=c:\dboxservice\server set utiltoolpath=c:\windows\microsoft.net\framework\v2.0.50727

Echo Local installation folder-%installpath%

IF not EXIST "%installpath%" (MKDIR "%installpath%" ECHO Folder%installpath% created)

IF EXIST "%installpath%\dropboxwindowsservice.exe" (%utiltoolpath%\installutil.exe "%installpath%\ DropboxWindowsService.exe "/u ECHO unregistered Service:%installpath%\dropboxwindowsservice.exe)

echo Start to copy files to service folder

Copy DropboxWindowsService.exe "%installpath%" copy DropboxWindowsService.exe.config "%installpath%" copy DropboxCore.dll "%installpath%" copy Log4net.dll "%installpath%"

ECHO Program Files copied to%installpath%

%utiltoolpath%\installutil.exe "%installpath%\dropboxwindowsservice.exe" ECHO registered Service (%InstallPath%\ DropboxWindowsService.exe)

net start Dropboxwindowsservice

ECHO DropBox Windows Service installed on Server successfully!

Pause

There have been errors:

Uninstalling assembly ' C:\DBoxService\Server\DropboxWindowsService.exe '.
Affected parameters is:
LogtoConsole =
AssemblyPath = C:\DBoxService\Server\DropboxWindowsService.exe
LogFile = C:\DBoxService\Server\DropboxWindowsService.InstallLog
An exception occurred and trying to find the installers in the C:\DBoxService\Server\DropboxWindowsService.exe assembly.
System.Reflection.ReflectionTypeLoadException:Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Aborting installation for C:\DBoxService\Server\DropboxWindowsService.exe.
Installing assembly ' C:\DBoxService\Server\DropboxWindowsService.exe '.

This error occurs because the name of the DLL referenced in the project has changed, and the DLL inside the installation package has not changed, causing the error above.

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.