2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Windowsサービスの起動バッチ

Last updated at Posted at 2016-10-25

管理者で起動

まずバッチを起動するのにいちいち右クリックで「管理者として実行」が面倒です
ショートカットを作成して詳細設定で「管理者として実行」を設定しておけばいいですが、他人に渡すときに説明するのを忘れてしまいます

最初の部分で管理者として実行されていない場合は自分自身を管理者として実行し直します

MSSQLSERVERサービスを起動する場合

MSSQLSERVER-start.cmd

REM SQL Server (MSSQLSERVER)開始

for /f "tokens=3 delims=\ " %%i in ('whoami /groups^|find "Mandatory"') do set LEVEL=%%i

if not %LEVEL%==High (
powershell start-process -verb runas '"%~f0" %*'
exit
)

net start MSSQLSERVER

timeout /t 30
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?