使用 cmd 启动 Activator

Start Activator using cmd

我想知道如何创建一个更改目录并启动激活器的bat文件

我试了没成功..

cmd /k cd c:\Users\user\project & activator -jvm-debug 9999 run
cmd /k cd c:\Users\user\project && activator -jvm-debug 9999 run
cmd /k cd c:\Users\user\project ; activator -jvm-debug 9999 run

cmd /k 将 运行 cd c:\Users\user\project 并立即进入 cmd 提示符。所以第二部分 activator -jvm-debug 9999 run 永远不会 运行.

您需要从批处理文件中删除 cmd /k

改用以下批处理文件:

@echo off
cd c:\Users\user\project && activator -jvm-debug 9999 run
  • 这将 运行 第一个命令 cd c:\Users\user\project
  • 如果第一个命令成功,那么 运行 第二个命令 activator -jvm-debug 9999 run

注意 activator 必须在 %path% 中才能工作。


来源cmd

Start a new CMD shell and (optionally) run a command/executable program.

Syntax

CMD [charset] [options]

CMD [charset] [options] [/C Command]

CMD [charset] [options] [/K Command]

Options

/C Run Command and then terminate

/K Run Command and then return to the CMD prompt. This is useful for testing, to examine variables


来源Redirection

commandA && commandB Run commandA, if it succeeds then run commandB