I'm trying to do some basic functionality using a batch file but the batch file opens cmd and runs the first command but then stops, ignoring the other commands. I've tried using START
and CALL
but neither I have had any success with, can anyone provide advice?
Batch file looks as below:
CD C:\Random\Madeup\Path
cmd.exe /K "npm install"
CALL gulp-publish.BAT
CD C:\Random\Madeup\Path\mobile\dist
REN C:\Random\Madeup\Path\mobile\dist\config.xml config-publish.txt
PAUSE
Answer
The batch file opens cmd and runs the first command but then stops
cmd.exe /K "npm install"
That is what /k
is intended to do:
/K Run Command and then return to the CMD prompt.
This is useful for testing, to examine variables
It runs cmd
and then immediately returns to the enclosing cmd
shell, which aslo bypasses the rest of the commands in the batch file.
Try replacing that line with:
npm install
or:
call npm install
No comments:
Post a Comment