Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 创建一个.bat文件并通过调用运行多个命令_Batch File_Command_Npm Install - Fatal编程技术网

Batch file 创建一个.bat文件并通过调用运行多个命令

Batch file 创建一个.bat文件并通过调用运行多个命令,batch-file,command,npm-install,Batch File,Command,Npm Install,我想在批处理文件中运行一些命令并使用if语句 @echo off call npm install echo node js instaled if not errorlevel 1 ( call composer install if not errorlevel 1 ( echo commands run success. ) else ( echo please install composer and then run this b

我想在批处理文件中运行一些命令并使用if语句

@echo off
call npm install
echo node js instaled
if not errorlevel 1 (
    call composer install
    if not errorlevel 1 (
        echo commands run success.
    ) else (
        echo please install composer and then run this batch again.
    )
) else (
    echo you have not nodejs in your system. please install nodejs.
)
当我在npm安装完成后运行此批处理文件时

node js installed
if was unexpected at this time.
如何检查命令的成功与否,然后运行其他命令。

尝试一下:

@echo off
call npm install && (
    echo node js installed
    call composer install && (
       echo Composer installed
    ) || echo composer install failed
) || echo Nodejs install failed
&&
是有条件的,如果第一个命令成功,则运行下一个命令
|
随后将成为
else
操作符