0

I'm trying to get a to execute the following code:

cmd /K C:\ProgramData\Anaconda3\Scripts\activate.bat C:\ProgramData\Anaconda3
cd C:\ProgramData\Anaconda3\Lib\site-packages\tabpy_server\
run startup.bat

The first line execute properly and opens an window. The next lines fail to execute.

What am I missing?

The idea is to create a batch file which can be added to to start the server service.

Compo
  • 36,585
  • 5
  • 27
  • 39
jwiniv
  • 1
  • 1
    The is no `run` command in windows. –  Dec 05 '19 at 23:41
  • Fair enough. The line prior still does not execute the change of directory. – jwiniv Dec 05 '19 at 23:43
  • 1
    It is waiting for you to exit the new command prompt you opened. Type `start /?`, `cmd /?`. –  Dec 05 '19 at 23:45
  • 2
    Not only that, but that window sets up your environment, but when it closes/finishes, that environment isn't passed to your running script. If you need that environment, I would suggest you use `Call` instead of `cmd /K`. Once `activate.bat` has completed, control will be returned to your [tag:batch-file]. – Compo Dec 05 '19 at 23:50
  • Thank you all for your help. Changing to the "call" command resolved my issue. I feel so dumb. – jwiniv Dec 05 '19 at 23:55
  • Yes, use `call` instead of `run` and `cmd /K`; and use `cd /D` rather than `cd`... – aschipfl Dec 06 '19 at 12:16

1 Answers1

0

There is no run command in batch. What you want is the start command. Also you want to use call instead of cmd /k because it is used for starting another instance of cmd while you just want to call the batch file. Here is an example:

call C:\ProgramData\Anaconda3\Scripts\activate.bat C:\ProgramData\Anaconda3
cd C:\ProgramData\Anaconda3\Lib\site-packages\tabpy_server\
start startup.bat