1
0

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.

バッチ ジョブを終了しますか (Y/N)? を回避して強制的に終了させる

Last updated at Posted at 2023-01-11

Windows10にて、あるプログラムにSIGINTを送って、強制終了させたかったが、しがらみだらけだった。
事情があって、SIGKILLではなくSIGINT,もしくはSIGTERMにて、自動的に正常終了させたかった。

まず、Windows環境にはSIGINT, SIGTERMは存在しないので以下のツールを使った。

SINGINTに関しては送信することに成功したが、今度はコマンドプロンプトに以下の表示が出て先に進まなくなった。
バッチ ジョブを終了しますか (Y/N)?
image.png

なんでだよ。。。

これもかなり時間かかったが、ユーザーに入力させずに強制的にYで進行する方法があったので記載しておく。
結論から言うと、以下のように目的のコマンドを start cmd /c と、<nul で挟んでやればよい。

start cmd /c <目的のコマンド> <nul

詳細は以下を参照のこと

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?