CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Win32 Programming Help:
Batch scripting

 



awaiz
Novice

Jun 3, 2010, 10:22 PM

Post #1 of 3 (11240 views)
Batch scripting Can't Post

Hi All,

I m trying to write a simple batch script. Here'e my script

*********************

@ECHO OFF

echo Adding the transports to the buffer

FOR /F %%i IN (tp_list.txt) DO ( tp addtobuffer %%i PSE client=100 pf=E:\usr\sap\trans\bin\TP_DOMAIN_PSE.PFL

if %errorlevel% NEQ 0 echo Transport %%i has ended in error

GOTO END

)

:END

**********************

I want the loop to continue when error NEQ 0 and the loop to exit if error = 0. tp_list.txt has many entries if the first one ended with error = 0 then it does not go to the next line item and just exists the loop.

Any quick help will be appreciated !

thanks in advance !

Awaiz.


BillKSmith
Veteran

Jun 4, 2010, 8:20 AM

Post #2 of 3 (11230 views)
Re: [awaiz] Batch scripting [In reply to] Can't Post

Use perl.


Code
  

use strict;
use warnings;

open my $f, '<', 'tp_list.txt' or die "Cannot open tp_list.txt\n";
local $/ = undef;
my @set = split /\s/, <$f>;
close $f;
for my $tp (@set) {
system(

"tp addtobuffer $tp client=100 pf=E:\\usr\\sap\\trans\\bin\\TP+DOMAIN_PSE.PFL"
)
and die "Transport $tp has ended in error\n";
}

Good Luck,
Bill


awaiz
Novice

Jun 12, 2010, 7:22 AM

Post #3 of 3 (11015 views)
Re: [BillKSmith] Batch scripting [In reply to] Can't Post

Hi
Could you give the same code in batch ?

Awaiz

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives