cmd /keep vs cmd /continue
If you are using /k
, and you don't need quotes, until you type exit
command, the next command on the bat/cmd
will never be executed.
You started a cmd /keep
"interpreter" and did not leave/exit/close it, only after this that your next command will be executed...
When you use the terminal by opening a new interpreter by typing 'cmd /k', it works because you are interacting directly with it, in this case in bat, onli line that work is: cmd /k "...\enable.bat"
, the bat file in command is also executed because it is on the same line.
In the bat, cmd / k somefile.bat [or] some command
it will start a new interpreter and keep it open for input until the moment you type exit or close the current cmd window. Otherwise, it will stay waiting for you to insert one or more commands to execute them, and in the code, the next execution is on the next line:
("C:\Arch\Upload from DB to Redcap.py"), it will never run unless you type it for this current interpreter, or type exit
to quit and return to previous interpreter run you next line command.
Try replace with cmd /c
and your interpreter will goon execute your code line by line...
But I think it’s not even a cmd
call running his bat/cmd
.
The command interpreter (cmd.exe
) will execute your bat
/cmd
just by executing or, when you click on it, there is no need to add a specific instruction to execute your bat
script.
Save this code below as file.bat and try:
@echo off
cd /d "%UserProfile%\AppData\Local\Continuum\Anaconda3"
call .\Scripts\Activate.bat "%UserProfile%\AppData\Local\Continuum\Anaconda3"
py "c:\Arch\Upload from DB to Redcap.py"
In addition, if you are using in one bat
file to to execute another bat
file, so use call c:\file.bat
...
[√] cmd
[√] cmd /MS Docs
[√] How to run multiple bat files within a bat file
call
i.e.call blah.bat