R
rsine
I've been using the following in a batch file to install a service for years:
@echo off
MyService.Hosts.WindowsService.exe --install
pause
When I tried to run the same batch file on server 2016, I got errors about not being able to find the exe file. So, I added at the top the following:
CD /D "%~dp0"
I still got errors about the EXE file which weren't resolved until I changed the batch file to this:
CD /D "%~dp0"
MyServiceHostsWindowsService.exe --install
pause
Note, I had to remove the dots between "MyService" and "Hosts" and between "Hosts" and "WindowsService". Of course, I renamed the exe to match and voila, the install worked. So, now I have the following questions:
1) Do the dots need to be removed from the EXE name or is there a way to allow them? Ideally, I don't want to have to rename the EXE as this EXE is used to install numerous services and thus I'd have to change every instance to not have these dots.
2) When I run the batch file now, the command window shows every line in the batch file even those that are remarks (REM). For example, the command windows shows:
C:\Program Files\MyServiceDirectory>MyServiceHostsWindowsService.exe --install
C:\Program Files\MyServiceDirectory>pause
Before it wouldn't do that and simply showed the install information. The only way for nothing to show is to use "@echo off" but then none of the install information shows in the command window either which isn't desirable especially if issues arise. So, is there a way to alter what is being done by the batch file to not display each line in the command window?
Thank you
Continue reading...
@echo off
MyService.Hosts.WindowsService.exe --install
pause
When I tried to run the same batch file on server 2016, I got errors about not being able to find the exe file. So, I added at the top the following:
CD /D "%~dp0"
I still got errors about the EXE file which weren't resolved until I changed the batch file to this:
CD /D "%~dp0"
MyServiceHostsWindowsService.exe --install
pause
Note, I had to remove the dots between "MyService" and "Hosts" and between "Hosts" and "WindowsService". Of course, I renamed the exe to match and voila, the install worked. So, now I have the following questions:
1) Do the dots need to be removed from the EXE name or is there a way to allow them? Ideally, I don't want to have to rename the EXE as this EXE is used to install numerous services and thus I'd have to change every instance to not have these dots.
2) When I run the batch file now, the command window shows every line in the batch file even those that are remarks (REM). For example, the command windows shows:
C:\Program Files\MyServiceDirectory>MyServiceHostsWindowsService.exe --install
C:\Program Files\MyServiceDirectory>pause
Before it wouldn't do that and simply showed the install information. The only way for nothing to show is to use "@echo off" but then none of the install information shows in the command window either which isn't desirable especially if issues arise. So, is there a way to alter what is being done by the batch file to not display each line in the command window?
Thank you
Continue reading...