I have batch file that execute my php script, but I dont know how to handle the empty argument, can you help me?
this is my batch script
echo off
set phppath=%1
set resultfolder=%2
set jsonfile=%3
shift
shift
shift
set PHP_HOME=%phppath%
set PATH=%PATH%;%PHP_HOME%
echo Set PHP_HOME in "%phppath%"
echo Locate result in folder "%resultfolder%"
echo JSON file is "%jsonfile%"
pause;
php -f cxense_json_to_xml.php %resultfolder% %jsonfile%
@echo off
set phppath=%1
set resultfolder=%2
set jsonfile=%3
set PHP_HOME=%phppath%
set PATH=%PATH%;%PHP_HOME%
echo Set PHP_HOME in "%phppath%"
echo Locate result in folder "%resultfolder%"
echo JSON file is "%jsonfile%"
php -f cxense_json_to_xml.php %resultfolder% %jsonfile%
Pause
And the batch would have to be started like this:
Batch.bat "path to PHP" "path to result folder" "name of jsonfile"
there is no semicolon after pause.