DCR
DCR

Reputation: 15657

bat file fails to execute commands

I have the following bat file:

set dir=%1
create-react-native-app %dir%
cd %dir%
call npm install --save react-native-ignore-warnings
call npm install babel-preset-env --save-dev
call npm install --save-dev babel-preset-stage-2

after create-react-native-app the bat file stops execution

Upvotes: 0

Views: 40

Answers (1)

Jeff Zeitlin
Jeff Zeitlin

Reputation: 10754

Based on your response to my comment, create-react-native-app is implemented as a batch file. In Windows (and in fact dating back many years to DOS), if you invoke a batch file from within another batch file, Windows/DOS "forgets" the first batch file. To prevent this, you need to CALL the second batch file from the first.

(as given, you don't actually need the variable dir; you can just use %1:

CALL create-react-native-app %1
cd %1
call npm install --save react-native-ignore-warnings
call npm install babel-preset-env --save-dev
call npm install --save-dev babel-preset-stage-2

)

Upvotes: 1

Related Questions