I need to run htpasswd from inside a batch script using a variables

  1. Posts : 233
    Win 10 Ver 1903

    I need to run htpasswd from inside a batch script using a variables

    I have tried this every way i can think of.
    the batch is in the same folder as the .htaccess file to be modified.
    i can run the htpasswd file with -v and -b which should allow for batch and give me a clue of what went wrong if it does
    i set a pause right after the statement runs
    statement exact is htpasswd -b %name% %password%
    next line types the .htaccess file to monitor and i can see the user and password have not been added
    As far as i can tell that is the correct format for the command to add a new name and password to an existing .htaccess
    Any advice appreciated but according to Apache I should be able to do this?
    the one error that does pop up says something like users 3ae24b (which was the correct value for the login)not found but there is no ask for the user's login
    the user's password is not mentioned.
    Should I put the username variable and password variable in quotes?
    How can i pipe this info into the htaccess file in batch using variable for the value of name and password

    At this point, i have tried so many variations i cant imagine but i am beginning to make typos so stopping for the night
      My Computer

  2. Posts : 456
    Windows 10

    You want this "htpasswd -b %name% %password%" to be appended to a text file called ".htaccess"?

    htpasswd -b %name% %password%>> .htaccess
      My Computer


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 17:54.
Find Us

Windows 10 Forums