У меня проблема при выполнении командного файла.
Мой пакетный файл завершается после того, как он достиг строки, чтобы выполнить запрос postgres
(
echo INSERT INTO Role SET roleName=%role%; INSERT INTO User (login, password, active, role) VALUE (%login%, %password%, 1, LAST_INSERT_ID());
) | psql -h %DB_HOST% -p 5432 -U %DB_USER% -d %DB_NAME%
Кто-нибудь может помочь решить эту проблему?
@echo off
title Create New User
set DB_HOST=localhost
set DB_USER=postgres
set DB_NAME=appdb
@echo Enter a new Login:
set /p login=
ECHO ============================
@echo Enter a new password:
set /p password=
ECHO ============================
@echo Enter again your new password:
set /p passwordConfirm=
goto VerifyPassword
:VerifyPassword
if %password% == %passwordConfirm% goto insertInDatabase
if not %password% == %passwordConfirm% goto PasswordSection
:PasswordSection
@echo Password incorrect, please retype your password
@echo Enter a new password:
set /p password=
ECHO ============================
@echo Enter again your new password:
set /p passwordConfirm=
goto VerifyPassword
:insertInDatabase
ECHO ============================
@echo Choose role of the user Admin A\U User:
set /p role=
@echo Inserting in Database ...
(
echo INSERT INTO Role SET roleName=%role%; INSERT INTO User (login,
password, active, role) VALUE (%login%, %password%, 1, LAST_INSERT_ID());
) | psql -h %DB_HOST% -p 5432 -U %DB_USER% -d %DB_NAME%
pause
exit