assuming the program doesn't have a method already like taking a parameter with the input or input file, then it sounds like a programming problem of automatically sending keys to a program. VBscript has SendKeys. VC++ no doubt has that or equivalent. otherwise it's autohotkeys/autoit. But look up any example of sendkeys in vbscript and you'll see an example.
Try the copy con
command manually to see how it works.
copy con c:\blah\a.a
then you enter the text of the file, and hit Ctrl-Z to write it.
So that involved entering things on the command line.
And try this vbscript which does that automatically
for command line. call this whatever.vbs
dim a
a="copy con c:\blah\file.123"
Set WshShell = Wscript.CreateObject("Wscript.Shell")
WshShell.SendKeys a
WshShell.SendKeys "dsdsfd{ENTER}sdfds{ENTER}sleep for 2000ms and will enter more{ENTER}"
Wscript.Sleep 2000
WshShell.SendKeys "ewrwrewrewwe{ENTER}"
WshShell.SendKeys "sending ctrl-z and enter {ENTER}"
Wscript.Sleep 2000
WshShell.SendKeys "^Z{ENTER}"
Thanks once again.In ours organization we does not have any language installed on systems (means no C, VC++ nor VB). I told that i know very little about programming language that is also only c & vc++ which is currently not installed in our organization. So that is why i have concluded that i have limitation of batch FILE. I would also appreciate if u can tell me any other solution other than batch file to run .exe file & pass input.As now you knows my limitations also. Thanks in advance – Balram – 2014-06-23T09:22:49.967
1Balram, can you share with us what the program is and what the inputs are? – N8sBug – 2014-06-06T10:25:08.440
I hate to break it to you, but it's Sending INPUT not reading input. If anything you're WRITING input not reading it. Besides the fact that it's in Windows, you're using the command prompt that's not DOS. i have corrected your question on that. – barlop – 2014-06-06T18:12:52.650
Thanks for your prompt reply Mr. Barlop. Actually my limitation is to feed data to .exe file through .Bat file only. – Balram – 2014-06-16T09:17:38.787
@Balram i'm pretty sure batch language can't, or can't in a sophisticated way.For example, u can do
C:\>echo sdf | pause
orecho y | del a.a
but send data to a program including multiple return keys, nope.If there was a command that does it(somebody, maybe pc magazine,wrote one unce for MS-DOS ) that can send keys, but I don't know of such a third party app.QBASIC and layer, VBscript,and now,powershell.They exist because of limitations of the batch language.vbscript is native and That vbscript code will run from command line if u have cscript.exe Why do you have the 'only batch' limitation? – barlop – 2014-06-16T09:46:57.417