Command prompt with React-Native

Asked

Viewed 604 times

3

People progamo em React - Native and every time I access the CMD to run the React I have to do a series of procedures that I will write below

Does anyone know any way to create a bat that already runs this command simultaneously one after the other?

Open CMD in document folder

Cd usuário 
Cd principal
Cd appdata 
Cd local 
Cd Android 
Cd SDK 
Cd plataforms- tools 

React-native TCP:8081 tcp8081 

Cd ../../../../../    
Cd documentos
Cd pasta
React-native run-android 
  • Have you ever tried to create a file with an ending . bat and the quoted commands? One on each line. Then just type the name of that file . bat

  • I didn’t try because I didn’t think it was that easy. I’ll try.

  • I got it. Just create the file. Bat

  • And put all commands that are executed one by one into the bat. Vlw

2 answers

0

:: Tchê, se entendi...

@echo off && cd  /d %systemdrive% & cd \ & title .:^|:. React-native run-android .:^|:. 

:: usuário == %username%

pushd "%userprofile%\principal\appdata\local\Android\SDK\plataforms- tools\"

call start /b .\React-native TCP:8081 tcp8081 && popd

:: Cd documentos seria a mesma pasta: user\documentos? caso contrário apague abaixo
cd "%userprofile%\documentos\pasta" && call start /b .\React-native run-android

:: cd documentos não seria a mesma pasta: user\documentos! caso contrário apague abaixo
cd "%userprofile%\documentos\pasta\" && call start /b .\React-native run-android

0

How did you tag and , believe that the Operating System is Windows, so in the command window you do not need to have to access one folder at a time, can access directly.

Assuming it’s on the Local Disk C: just access the folder directly that by following the commands you placed should be:

CD "C:\usuário\principal\appdata\local\Android\SDK\plataforms- tools\"

Use quotation marks when a folder has space in its name.

And then turn the command:

React-native TCP:8081 tcp8081

Considering the commands (CD ..) afterward:

CD C:\usuário\principal\documentos\pasta\

Then you can run the command:

React-native run-android 

Placing these commands on separate lines in a text editor and saving with the extension .bat you can make everything run just by opening the file.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.