Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Using SC (Service Controller) command in a batch file

Featured Replies

Hi All,

Im using a little batch file for configuring a remote shell service for a specific account.The only problem is,that the password when wanted to leave as default by the batch (Admin) is somehow not set by the service and I have to do it manually then.

Here is the code:

echo Now configuring the Remote Shell Service

echo Stopping the Service
sc stop RshSvc

echo Enter the Password for Admin account or ENTER to leave it as Admin
set /p adminpwd=:
if "%adminpwd%"=="" set pwd=Admin
if %errorlevel%==0 set pwd=%adminpwd%

sc config RshSvc type= own obj= %computername%\Admin password= %pwd%

echo Starting the service
sc start RshSvc

Any idea where's the bug?

Any idea where's the bug?

Cannot say if it is a bug, but usually with this kind of batches it is better to use "negative logic".

@ECHO OFFSET Defaultpwd=Adminecho Now configuring the Remote Shell Serviceecho Stopping the Servicesc stop RshSvcecho Enter the Password for Admin account or ENTER to leave the default oneset /p adminpwd=Type password or press [ENTER] to leave the Default one.IF NOT DEFINED adminpwd SET adminpwd=%Defaultpwd%sc config RshSvc type= own obj= %computername%\Admin password= %adminpwd%echo Starting the servicesc start RshSvc

jaclaz

What happens if you change it like this:

@echo offsetlocalecho=Now configuring the Remote Shell Serviceecho=Stopping the Servicesc stop RshSvcecho=Enter the Password for Admin account or ENTER to leave it as Adminset /p "adminpwd = "if not defined adminpwd (set adminpwd=Admin)sc config RshSvc obj= "Admin" password= "%adminpwd%"echo=Starting the servicesc start RshSvc

The %errorlevel% is of the previews "set pwd=Admin" command? Which is supposed to be the default password? Maybe the correct syntax would be "if "%adminpwd%"=="" set %adminpwd%=Admin"? I think that as it is writen if %adminpwd% is null it remains so and pwd becomes null also.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.