I have a batch file with 2 commands as below
echo y | "%10\putty\plink.exe" -ssh %6@%1 -pw "%7" exit
"%10\putty\plink.exe" -ssh %6@%1 -pw "%7" "/u01/./script.sh %1 %2 %3 %4 %5 %6 %7 %8 %9"
As you can see it takes 10 parameters from another program which calls this batch.
The issue here is with the 10th parameter, as we can only use parameter upto %9 and after that %10 is considered as %1 i.e. first parameter and 0 as another value.
How I can solve this?
I have checked this How to pass more than 9 parameters to batch file , However in my case the parameter positions are different as the first parameter passed to command is actually the 10th parameter passed from the program i.e. echo y | "%10\putty\plink.exe"
I'm a bit out of clue how i can use shift here.
Please help !!
EDIT:
I tried to change the position of parameter from program call itself such that i just have to pass the 10th parameter like this:
echo y | "%1\putty\plink.exe" -ssh %7@%2 -pw "%8" exit
"%1\putty\plink.exe" -ssh %7@%2 -pw "%8" "/u01/./script.sh %2 %3 %4 %5 %6 %7 %8 %9
shift
shift
shift
shift
shift
shift
shift
shift
shift
shift %1"
And parameters passed was as expected, but the issue here is the command is not getting executed in one go.
i.e.
"%1\putty\plink.exe" -ssh %7@%2 -pw "%8" "/u01/./script.sh %2 %3 %4 %5 %6 %7 %8 %9 %10"
is a single command however shift is also getting executed as command.