Whereas the path to the api has already been set in the variable %path%, you have already tried only to run call composer update
? Look at that answer Running "Composer update" Within a Windows . bat file
Use the command cd
== check directory
, using the flag /d
, makes go to the drive, useful option when using commands between folders and different drives.
Your command can be on a line using operators:
• Observations on operators: &, |, && e ||
execute & execute & execute
execute | recebe _saída_do_comando_anterior
execute | recebe _saída_do_comando_anterior & execute
executou_sem_erro && então_execute_também
executou_com_erro || execute_também_porque_deu_erro
executou_com_erro || executou_com_erro || executou_com_erro
executou_sem_erro && executou_sem_erro && executou_sem_erro
executou_sem_erro && então_execute || execute_esse_no_primeiro_deu_erro
rem :: entre na pasta/check directory
cd /d "C:\Users\Luiz\api"
rem :: daí execute o update do compuser ::
composer update
rem :: ----------
rem :: para fazer em uma linha ::
cd /d "c:\Users\Luiz\api" && composer update
rem :: usando variável %userprofile% do ambiente ::
rem :: usando operador && (execute (se executou sem erro) && também execute)
cd "%userprofile%\api" && composer update
For most Apis, sending commands for execution is in this syntax:
cmd /c cd /d "C:\Users\Luiz\api" && composer update
Already in compuser is different, in it you use script by predefined event, or something like.
But I think it would be better to take a look at the documentation that addresses the ways to add scripts/commands on the computer:
One answer treating the use of script in the computer
Like make a Calling Composer
Answer how to run a cmd/bat to update the Composer
5 tricks of the composition