خرید بک لینک

Vote count: 0

I'm trying to do simple batch script (cmd) that will check if required packages are installed, if not it will install them and then will call my command.

I've managed to check if node is installed using:

node -v >nul 2>nul
if %errorlevel%==9009 (
echo Install node.js and restart this script
goto :EOF
)

now I'm trying to check if specific npm package exists. I'm able to display error when package is not installed using:

npm list bootprint --depth=0 >nul 2>nul || echo bootprint not found!

but every line after after that isn't evaluated. Below is my full code:

@echo off
setlocal EnableDelayedExpansion
::check if node.js is installed
node -v >nul 2>nul
if %errorlevel%==9009 (
echo Install node.js and restart this script
goto :EOF
)
::bootprint
set installed=1
npm list bootprint --depth=0 >nul 2>nul || set installed=0
if !installed!==0 (
echo installing...
npm install bootprint
echo OK
)

::bootprint-swagger
set installed=1
npm list bootprint-swagger --depth=0 >nul 2>nul || set installed=0
if !installed!==0 (
echo installing...
npm install bootprint-swagger
echo OK
)

echo Everything installed. Ruing script...
bootprint swagger http://api.mydomain.com/v1 docs

I found bash script that checks things I want to check from batch file, but I have problem converting it.

asked 33 secs ago

برچسب: batch file commands,batch file,batch file comment,batch file programming,batch file variables,batch file if,batch file rename,batch file examples,batch file for loop,batch file pause, نویسنده: استخدام کار تاريخ: سه شنبه 19 مرداد 1395 ساعت: 17:29

صفحه بندی