[thelist] Apache: Batch file with input?

Andrew Seguin asegu at borg.darktech.org
Mon Aug 4 12:00:11 CDT 2003

Dos batch accepts password from command line: As is I don't know how to
get input any other way within batch without using command line tools to
set environment variables and use that...

But, if you can accept making a bath file that is called like:
c:\>htc.bat <directory> <username> <new password>

then the following could maybe work for you (for usage shown above):

------------- htc.bat --------------
@echo off
rem Making a temp file with the
rem input that would normaly be typed
echo %3 >\htctemp.txt
echo %3 >>\htctemp.txt

rem Assuming running from proper drive.
cd %1

rem call htpasswed (htpasswd?)
rem and feed in the password.
htpasswed -c .htpasswd %2 <\htctemp.txt

hope that helps,

> I'm exploring Apache, these day, and one of the things that I want to do
> is
> to implement my .htaccess docs. It's a bit of a pain though to constantly
> drop into the dos prompt and type everything by hand.
> Can someone show me an example of a dos batch file that accepts input?
> Here
> is ultimately is an example of what I'd like to create.
> cd /path_to_desired_dir
> htpasswed -c .htpasswd username
> New password: INSERT_PASS_HERE
> Re-Type new password: INSERT_PASS_HERE
> adding password for user username
> Thanks
> --
> Frank Marion     lists at frankmarion.com      Keep the signal high.
> --
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !

More information about the thelist mailing list