Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > create a batch file

Reply
Thread Tools

create a batch file

 
 
king
Guest
Posts: n/a
 
      10-23-2007
#!\c\perl\bin
use strict;
my $register="e0010088";
open(fh,">check.bat")
print fh "\@echo\n";
print fh "\@echo Comparing X16 reg\n";
print fh "check $register > test.log\n";
print fh "fc /l log test.log > comp.log\n";
print fh "find \"no differences encountered\" comp.log\n";
print fh "if errorlevel 1 goto fail1\n";
print fh "echo fine\n";
print fh "del test.log\n";

close (fh);

while running this file to create a batch file I am getting a error
saying error at print.

I want to create a batch file named check.bat which should contain the
below things: and the $ register value need to be replaced.
===============
@echo
@echo Comparing X16 reg
check $register > test.log
fc /l log test.log > comp.log
find \"no differences encountered\" comp.log
if errorlevel 1 goto fail1
echo fine
del test.log
=================

 
Reply With Quote
 
 
 
 
Michele Dondi
Guest
Posts: n/a
 
      10-23-2007
On Tue, 23 Oct 2007 12:55:44 -0000, king <(E-Mail Removed)>
wrote:

>print fh "\@echo\n";
>print fh "\@echo Comparing X16 reg\n";
>print fh "check $register > test.log\n";
>print fh "fc /l log test.log > comp.log\n";
>print fh "find \"no differences encountered\" comp.log\n";
>print fh "if errorlevel 1 goto fail1\n";
>print fh "echo fine\n";
>print fh "del test.log\n";


In addition to the other gotchas mentioned by others, consider using a
an here doc:

print $fh <<"EOBATCH";
\@echo
\@echo Comparing X16 reg
check $register > test.log
fc /l log test.log > comp.log
find "no differences encountered" comp.log
if errorlevel 1 goto fail1
echo fine
del test.log
EOBATCH


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a batch file to run a Java application Cyril Dex Java 7 03-10-2013 06:46 AM
How to create a batch file for Java Console Application? Mozart Java 7 06-16-2011 07:41 AM
how to create a batch file ? sihle87@gmail.com Java 3 02-14-2008 03:46 AM
create a batch file king Perl Misc 4 10-23-2007 06:21 PM
Create my own batch file to compile ASP.NET assemblies Raterus ASP .Net 1 04-23-2004 02:12 PM



Advertisments