Re: Running a bat file

Ryan Boggs <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nant.user
Message-ID <[email protected]>
Hi,

2010/4/18 Simon H <[email protected]>:
> You are probably correct that the batch file is waiting for input from NAnt
> as it does not seem that control has been properly passed to cmd.exe to
> accept user input. I will explain what I need to do further to clarify why
> it is desirable to use a bat file like this with NAnt.
>
> I am designing a automated compilation script for an Oracle Forms and
> Reports development environment containing numerous databases with
> associated projects. As the username and password for connecting to the
> databases differs, and because of organisational measures in place that
> require that developers are not privy to the username and password for
> various databases (only DBA's have these rights), the ideal solution is to
> prompt the user (whether it be developer or DBA) for the username, password
> and database relevant to the files they wish to have automatically
> compiled. As a bat file that achieves most of this functionality has already
> been created, I was hoping to use that since I have not learnt any of
> the scripting languages supported by NAnt and I am not aware of any other
> way to achieve what I need. Do you have any suggestions for how I
> can achieve what I need?

Well, the only thing I can think of is setting up the nant build file
to pass the username, password, and database name to the batch scripts
through the <exec> <args> command.  I understand the security issues
at hand for this but you could have the user set the   login
credentials in the command line, like so:

"nant -D:username=user -D:password:pw -D:database=exampleDB"

Of course, this means that the batch file needs to be updated to
accept commandline arguments.

There may be a better approach to this but this is the only one coming
to mind right now.

Thanks,
Ryan

>
>> Date: Sun, 18 Apr 2010 21:23:31 -0700
>> Subject: Re: [NAnt-users] Running a bat file
>> From: [email protected]
>> To: [email protected]
>> CC: [email protected]
>>
>> Hi,
>>
>> At first glance, the reason why it freezes is because it looks like
>> the batch file is waiting for user input that NAnt isn't providing.
>>
>> I'm sorry, I have to ask. Why are you running a batch file from a
>> NAnt build file? Seems like overkill to me, unless you have a
>> specific need for it.
>>
>> Thanks,
>> Ryan
>>
>> 2010/4/18 Simon H <[email protected]>:
>> > Hi guys,
>> >
>> > I'm trying to run a bat file that displays a menu and accepts user input
>> > from the commandline as input. To clarify, here is an excerpt of the bat
>> > file:
>> >
>> > :topoffile
>> > @echo off
>> > @echo =================================================
>> > @echo This is an Oracle Forms Compilation facility
>> > @echo =================================================
>> > @echo.
>> >
>> > :accountagain
>> > @echo off
>> > @echo Please enter Schema owner account and
>> > set /p schemaowner=press return key, or QUIT to end:
>> > if /i [%schemaowner%]==[QUIT] endlocal&goto end
>> > @echo.
>> > @echo =================================================
>> > @echo Schema owner account entered was: '%schemaowner%'
>> > @echo =================================================
>> > if [%schemaowner%]==[] goto WrongAccount
>> > @echo.
>> >
>> > In my nant build file I have the following target code:
>> >
>> > <target name="menu" description="display build menu">
>> > <!-- password.bat is in the project basedir -->
>> > <exec program="password.bat">
>> > </target>
>> >
>> > However, when I run the build file I get the following output:
>> >
>> > menu:
>> >
>> >      [exec] ♀♀=====================================
>> >      [exec] This is an Oracle Forms Compilation Facility
>> >      [exec] =======================================
>> >      [exec]
>> >      [exec] Please enter Schema owner account and
>> >
>> > The execution of the bat file stops/freezes and cmd.exe will not accept
>> > any
>> > input and I have to Ctrl+C to return to the command prompt. How do I get
>> > nant to correctly execute the bat file? Thanks in advance!
>> >
>> > ________________________________
>> > Meet local singles online. Browse profiles for FREE!
>> >
>> > ------------------------------------------------------------------------------
>> > Download Intel&#174; Parallel Studio Eval
>> > Try the new software tools for yourself. Speed compiling, find bugs
>> > proactively, and fine-tune applications for parallel performance.
>> > See why Intel Parallel Studio got high marks during beta.
>> > http://p.sf.net/sfu/intel-sw-dev
>> > _______________________________________________
>> > NAnt-users mailing list
>> > [email protected]
>> > https://lists.sourceforge.net/lists/listinfo/nant-users
>> >
>> >
>
> ________________________________
> Find it at CarPoint.com.au New, Used, Demo, Dealer or Private?

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
NAnt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.