Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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

by BrowserUk (Patriarch)
on Mar 01, 2012 at 02:49 UTC ( [id://957073]=note: print w/replies, xml ) Need Help??


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

I tried 'myfile.pl < pl_input.txt' .... But it doesn't work ...

Works fine for me:

C:\test>junk.pl < junk.pl >< elihw _$ esrever ralacs tnirp C:\test>

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

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 22:02 UTC
    The fact it works for you makes me wonder what configuration settings or other special constructs might be needed for this to work on my computer. Are there any environment variables that might need tweaking? Or anything to put in the script file? tnx, jmk
      Are there any environment variables that might need tweaking? Or anything to put in the script file?

      How about you provide a little more information:

      1. What version of perl are you using?

        perl -v

      2. What version of "DOS" are you using? ver
      3. What file associations do you have? assoc .pl

        The above produce output like: .pl=xxxx. Substitute whatever you get instead of 'xxxx' into the following command: ftype xxxx

      4. The output from the following two commands:
        set pat set per
      5. Your full runnable code.

        Or if it is huge or proprietary; a complete, self-contained, runnable script that demonstrates the problem.

      6. A cut&paste of the console log showing the posted code being run on your system.

      If you supply that information, we here will almost certainly be able to solve your problem. Without it, all we can do is guess, usually wrongly.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?

        ver Microsoft Windows XP Version 5.1.2600 perl -v Active State This is perl, v5.8.9 built for MSWin32-x86-multi-thread assoc .pl=Perl
        #! Perl ###################################################################### +######################################### # # input_demo.pl - Requires Active Perl 5.8.9 Or Higher # # ###################################################################### +######################################### #require 5.8.9; # Use Version 5.8.9 of Perl #use lib "D:/Perl_510/lib/core "; use English '-no_match_vars'; use File::Copy; use IO::Handle; use Win32; use Win32::File qw/GetAttributes SetAttributes/; my $runnum = 0; my $program = 1; 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 . ":"; print "\nProgram: $program, leaves you in directory: $prgmdir\t y +our input is: $prgmd \n"; } RECYCLE: print "\nTo quit enter 0\n"; chomp( $program = <STDIN>); #Quit or rerun program if ( $program == 0 ) { exit 1;} goto RECYCLE; #exit 1;
        Input data file:
        c:\temp 1 1 0
        Run Results: Manual run in DOS window:
        >dos_input_test.pl Program thinks it is located in the following directory: D:\data\Rx Utils if incorrect (PATH has spaces)! Enter full path or return c:\temp Program: 1, leaves you in directory: D:\data\Rx Utils your input is: c:\temp To quit enter 0 1 To quit enter 0 1 To quit enter 0 0
        Run with input file:
        >dos_input_test.pl < pl_input.txt Program thinks it is located in the following directory: D:\data\Rx Utils if incorrect (PATH has spaces)! Enter full path or return Program: 1, leaves you in directory: D:\data\Utils your input is: To quit enter 0 >
        -------end of run data ---------- Your help is most appreciated! Thanks, JMK
        >assoc .pl .pl=Perl >ftype Perl Perl="d:\perl\bin\perl.exe" "%1" %* >set pat Path=d:\PERL\site\bin;d:\PERL\bin;C:\Program Files\Business Objects\Co +mmon\3.5\b in\NOTES\;C:\Program Files\Business Objects\Common\3.5\bin\NOTES\DATA\ +;<snip> PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH >set per Environment variable per not defined >
        I think I see where this is going, but I still need help. Much appreciated, JMK

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://957073]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-24 21:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found