in reply to Re^3: How Do I Get Batch Input to Work in DOS?
in thread How Do I Get Batch Input to Work in DOS?

>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

Replies are listed 'Best First'.
Re^5: How Do I Get Batch Input to Work in DOS?
by BrowserUk (Patriarch) on Mar 02, 2012 at 21:29 UTC

    The only thing I see missing is .pl from pathext, but all that does is allow you to omit the .pl from commands. Which you aren't doing in your examples, so NP.

    But, when I run your example in the manner you demonstrated, it works as you'd expect:

    C:\test>type junk2.pl #! 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 + directory:\n"; print "\t$cwd\n"; print "if incorrect (PATH has spaces)! Enter full pat +h or return\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 your 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; C:\test>type junk.dat fred 1 1 0 C:\test>junk2.pl < junk.dat Program thinks it is located in the following directory: C:\test if incorrect (PATH has spaces)! Enter full path or return Program: 1, leaves you in directory: C:\test your input is: fred To quit enter 0 To quit enter 0 To quit enter 0

    The logic of your test code is a bit mixed up, (and are you aware that changing the cwd within a program will be "undone" when the program exits?), but why you are apparently seeing different behaviour to me when that code is run I cannot explain. Nor diagnose.

    The only question I can think to ask: how did you install your copy of Perl? AS offer two methods: a zip file and a .msi.

    In the past I tried the zip file (smaller download), but had problems -- the post unzip command file that is meant to fix-up the installation didn't complete properly and left the install in a mess. I ended up blowing the whole thing away -- include searching the registry and deleting any keys that appeared to be related, a non-recommended process not for the faint of heart -- and then installing the .msi which "Just worked". And I've used the .msi's ever since.

    The symptoms of your problem seem to be very much related to your installation rather than Perl itself, and as such, you may well get better help on the AS forums than here.


    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?

      Thanks for the note. When you do a "set per" what do you get on your screen? I'm suspecting that certain env variables need to get set which probably didn't occur. FWIW - my perl install came from Active Perl which was included and installed from IBM's rational clear case product.
        When you do a "set per" what do you get on your screen?

        Exactly the same as you: Environment variable per not defined. There are a whole bunch of PERL* environment vars that can be used to influence its behaviour for particular purposes, and I was recently caught out by one, hence the ask.

        But in the normal way of things, I only define them when I have a particular need, and on a session by session basis so that they 'go away' of their own accord naturally. I never add them to the master environment.

        my perl install came from Active Perl which was included and installed from IBM's rational clear case product.

        You could try installing a newer version direct from AS. It's possible that IBM have monkeyed with the distribution version.

        (I hate suggesting that unless I have a realistic idea that it might actually fix something. In this case I have no such expectation.)

        It always put me in mind of first-level support for satellite dishes & and ADSL modems.

        "Have you tried switching it off for 30 seconds and back on again?". Oh no, I only switched it off for 25 seconds. Will it make a difference?


        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?