Execute Shell script via Plink

I am trying to create a bat file with the below piece of code.

plink.exe -l username -pw password -P 22 -2 -ssh servername
sudo su - devuser
cd /opt/sample
echo 3 | ./Script.sh

It executes only the first line and not the rest of the lines.
Can you please help me where am I doing wrong?

You haven't fed that code into plink, therefore it's not being fed into plink.

CPM-style commandline doesn't have many effective redirection methods, so this is much harder in CMD than it would be in shell. It would be far better to save the commands you want in an external file so you could do:

plink.exe -l username -pw password -P 22 -2 -ssh servername -batch -m commands.txt

"Sorry, user is not allowed to execute '/bin/su �� devuser' as root on
servername."
The above is the error that I get.
Basically my user does not have access to execute the script on the folder that I mentioned.
Does it mean that the sudo didnt implement at all?

---------- Post updated at 01:19 PM ---------- Previous update was at 12:55 PM ----------

The below is the piece of code I had in command.txt

sudo su - devuser
cd /opt/sample
echo 3 .Script.sh

Much like plink -- or any other command -- if you don't feed commands into su, they don't get fed into su. It doesn't just "take over" the script you're running.

Fortunately, it's a lot easier to feed things into a program in UNIX sh than in CPM.

sudo su � devuser <<EOF
cd /opt/sample
echo 3 .Script.sh
EOF

The problem is I have 100+ servers where I need to run the desired shell script.
It is a himalayan task to have the script modified with the few more lines of script.

I tried the below code in commands.txt file.

sudo su � devuser <<EOF 
cd /opt/sample 
echo 3 ./Script.sh 
EOF

I got the below response.
"[sudo] password for username:"
Even if I enter the password it is displaying the below error.

Sorry, user username is not allowed to execute '/bin/su � devuser' as root on server

I know that username doesn't have the persmission to execute the script in the desired folder.
I am thinking that still sudo is not executed properly.

Why not login as devuser in the first place, instead of ssh-ing into the wrong user? Then you'd be logged in as the right user with the right password and not have to deal with any cramming-a-bruteforced-password-into-su nonsense -- which is even more difficult than it sounds, because a UNIX password prompt is designed to prevent passwords being typed into it automatically. 'interactive password authentication' means 'password typed by a human being in realtime' authentication and no program pretending to be a human is acceptable...