@echo off
SET "p0=%~0"
SET "p1=%~1"
SET "p2=%~2"
SET "p3=%~3"
SET "p4=%~4"
SET "p5=%~5"
SET "p6=%~6"
SET "p7=%~7"
SET "p8=%~8"
SET "p9=%~9"
SHIFT
SET "p10=%~9"
SHIFT
SET "p11=%~9"
SET "zip_path=D:\OraOutput\interco\%p10%"
echo Program Name : %p0%
rem echo "Next param : %p1%
echo Next param : Username/Password
echo User Id : %p2%
echo User Name : %p3%
echo Request ID : %p4%
echo File Name : %p5%
echo Entity Name : %p6%
echo Email Address : %p7%
echo Extract ID : %p8%
echo path name : %p9%
echo share directory : %p10%
echo Master Request ID : %p11%
rm !(D:\temp\XX.txt)
echo Process and Mail Output files
echo %zip_path%
IF NOT EXIST D:\OraOutput\interco\%p10%\out\%p11%\ GOTO MAPERROR
cd D:\OraOutput\interco\%p10%\out\%p11%\
echo changed to D:\OraOutput\interco\%p10%\out\%p11%\
IF EXIST D:\OraOutput\interco\%p10%\out\%p11%\chello_compressed_interco_files.zip rm D:\OraOutput\interco\%p10%\out\%p11%\chello_compressed_interco_files.zip
zip -j D:\OraOutput\interco\%p10%\out\%p11%\chello_compressed_interco_files.zip D:\OraOutput\interco\%p10%\out\%p11%\*.*
echo after zip
IF NOT EXIST D:\OraOutput\interco\%p10%\out\%p11%\chello_compressed_interco_files.zip GOTO ENDPROCESS
echo zip file exists after zip
REM rm D:\OraOutput\interco\%p10%\chello_interco*.*
echo Before Mail to %p7%
D:\OraOutput\interco\es.exe %p7% "Chello Interco Extract has completed" "Please find attached the compressed Intercompany spreadsheets" D:\OraOutput\interco\%p10%\out\%p11%\chello_compressed_interco_files.zip
echo After Mail to %p7%
rm D:\OraOutput\interco\%p10%\out\%p11%\chello_compressed_interco_files.zip
GOTO ENDPROCESS
:MAPERROR
echo The Share Directory has not been mapped Contact your System Administrator
EXIT -1
:ENDPROCESS
echo Process finished goodbye
What have you tried so far?
post is deleted
A couple things:
# This is wrong. The space alters the meaning into 'set DATAFILE blank and run the program /OraOutput/interco/'.
DATAFILE= /OraOutput/interco/
DATAFILE1= /OraOutput
# Do this instead:
DATAFILE=/OraOutput/interco
DATAFILE1/OraOutput
# Why are you exporting all these when you could have just used ${1} instead of ${p1} anyway?
export p0=$name
export p1=$1
export p2=$2
export p3=$3
export p4=$4
export p5=$5
export p6=$6
export p7=$7
export p8=$8
export p9=$9
# The reason you had to 'shift' here is because
# variables 10 and higher need to be enclosed like ${10} or it will assume you wanted $1.
# It's a good habit to do that for all variables really.
export p10=${10}
export p11=${11}
export "zip_path=$DATAFILE1"
# Do NOT put $ for 'read'. It takes a variable NAME, not a variable VALUE.
read -r -p "Program Name :" p0
# echo "Next param :" p1
read -r -p "Next Param User name :" Username
read -r -p "Next Param Password :" Password
read -r -p "User Id :" p2
read -r -p "User Name :" p3
read -r -p "Request ID :" p4
read -r -p "File Name :" p5
read -r -p "Entity Name :" p6
read -r -p "Email Address :" p7
read -r -p "Extract ID :" p8
read -r -p "path name :" p9
read -r -p "share directory :" p10
read -r -p "Master Request ID :" p11
echo "Process and Mail Output files"
echo "$zip_path"
if [ ! -d "$DATAFILE" ] && [ ! -d "$DATAFILE1" ];
then
echo "The Share Directory has not been mapped Contact your System Administrator"
else
cd "$DATAFILE"
echo "changed to datafile"
fi
if [ -e "$DATAFILE/chello_compressed_interco_files.zip" ];
then
# *.* is a DOS thing.
# * doesn't expand outside quotes.
zip -j "chello_compressed_interco_files.zip" $DATAFILE/*
else
echo "after zip"
fi
# -d is for directories. Use -e to check if a file exists.
if [ ! -e "chello_compressed_interco_files.zip" ];
then
echo "Process finished goodbye"
else
echo "zip file exists after zip"
# rm "$DATAFILE1"
echo "Before Mail to $p7"
fi
# .exe files are a Windows thing. If this isn't Windows, you can't run them.
"$DATAFILE/es.exe" $p7 "Chello Interco Extract has completed" "Please find attached the compressed Intercompany spreadsheets" "chello_compressed_interco_files.zip"
echo "After Mail to $p7"
echo "Process finished goodbye"
i tried its ending into error...can u pls provide me a new code for the orginal file
Ending in what error?