Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: How Do I Get Batch Input to Work in DOS?

by Riales (Hermit)
on Mar 01, 2012 at 01:57 UTC ( #957068=note: print w/replies, xml ) Need Help??

in reply to How Do I Get Batch Input to Work in DOS?

I'm not familiar with DOS, but I would think you need to actually print the contents of pl_input.txt to STDOUT before piping it into your program. This is how I would do it in bash:

$ cat pl_input.txt |

EDIT: Nevermind, I did some research and it looks like what you were doing should be fine. Maybe post your code/input file so we have some more to go on? What's happening that's unexpected?

Replies are listed 'Best First'.
Re^2: How Do I Get Batch Input to Work in DOS?
by jmk2012 (Initiate) on Mar 01, 2012 at 20:05 UTC
    Thanks for the response. Here are some more details - The script is a format checker (aka linter) for script input - to ensure against typos. You provide the directory where the files are located, indicate the exam you want performed and the script generates a report of any errors found. If you want to retest- well, an input file of commands would be helpful, thus my question. Here's the code snippet that receives the input.
    if( $runnum < 1) { $cwd = Win32::GetCwd(); $prgmdir = $cwd; # $prgmpth = "$prgmdir\\"; print "\nProgram thinks it is located in the following directo +ry:\n"; print "\t$cwd\n"; print "if incorrect (PATH has spaces)! Enter full path or ret +urn\n\n"; chomp ($prgmd = <STDIN>); if( $prgmd =~ /^([a-zA-Z];\\).+$/ ) { $prgmdir = $prgmd; } else { $prgmdir = $cwd; } $prgmdir =~ /^(\w:).*/; $prgmdrv = $1 . ":"; }
    When I run the script, I get the above query which seems to get some input (but nothing obvious on screen) where it next goes to the menu containing the "exit" command and then goes to the dos prompt as if it concluded. A check of the output directory indicates no activity. I expected to see some material to the screen and/or results in the work directory - but this is not the case, thus the question on what it would take to get it to work. jmk

      When you run your script, do you get those lines about where the program thinks it is and if it's incorrect to enter the full path or return? Have you tried adding a print after you assign to $prgmdrv to see what it's doing at that point? (Standard 'print statements everywhere!' advice, but still...)

      I wonder if it might make more sense to modify the original script to optionally take an input file of commands instead of trying to pipe the commands in externally?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://957068]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2018-06-19 17:20 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (114 votes). Check out past polls.