Reading a value from a file in a windows batch script

后端 未结 3 2455
陌清茗
陌清茗 2021-02-20 17:57

I\'m trying to read a value from a file and use it in a subsequent command.

I have a file called AppServer.pid which contains the process id of my app serve

3条回答
  •  无人及你
    2021-02-20 18:17

    This works:

    SET /P VALUE_FROM_FILE= < AppServer.pid
    taskkill /pid %VALUE_FROM_FILE% /f
    

    The /P parameter used with SET allows you to set the value of a parameter using input from the user (or in this case, input from a file)

提交回复
热议问题