what is the dos command equivalent of echo?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
annyarun
Posts: 4
Joined: 11 Oct 2012 04:56

what is the dos command equivalent of echo?

#1 Post by annyarun » 11 Oct 2012 05:00

Hi All,

I have a unix script which runs like below.

echo -e "Y\nY"|perl test.plx

test.plx prompts for two user inputs and echo used to pass these parameters.

can anybody tell me how i can use the same in DOS/Batch program.

Thanks,
Arun

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: what is the dos command equivalent of echo?

#2 Post by foxidrive » 11 Oct 2012 06:01

Try these two options. It depends if perl.exe accepts redirected or piped input.



Code: Select all

@echo off
>temp.tmp echo Y
>>temp.tmp echo Y
type temp.tmp|perl test.plx
del temp.tmp



Code: Select all

@echo off
>temp.tmp echo Y
>>temp.tmp echo Y
perl test.plx <temp.tmp
del temp.tmp

annyarun
Posts: 4
Joined: 11 Oct 2012 04:56

Re: what is the dos command equivalent of echo?

#3 Post by annyarun » 11 Oct 2012 06:40

Yes.. i tried both options.. But no luck :(

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: what is the dos command equivalent of echo?

#4 Post by Squashman » 11 Oct 2012 06:45

Change the Perl script to get the arguments from the command line. It can take command line arguments the same way batch files can.

foo.pl Y N

annyarun
Posts: 4
Joined: 11 Oct 2012 04:56

Re: what is the dos command equivalent of echo?

#5 Post by annyarun » 11 Oct 2012 06:48

But thing is i should not be editing the perl script.. Its used by many others and just for my purpose i need this to be done.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: what is the dos command equivalent of echo?

#6 Post by foxidrive » 11 Oct 2012 06:53

Call your copy of the script something else, and make a batch file to run it.

Anyone else that uses the PC can still use the conventional commands.

annyarun
Posts: 4
Joined: 11 Oct 2012 04:56

Re: what is the dos command equivalent of echo?

#7 Post by annyarun » 11 Oct 2012 10:25

there are complications again.. its not just that.. the script keeps changing.. and there are many other constraints too.. i want to if it is possible to pass two parameters using echo command.. or any other command..

Post Reply