Computing.Net > Forums > Programming > Use entered password, else use stor

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Use entered password, else use stor

Reply to Message Icon

Name: remgu
Date: September 16, 2008 at 11:23:03 Pacific
OS: xp
CPU/Ram: 2gb
Product: white box
Comment:

I have a batch file and I need to do the following:

Say we have a variable that has a value:

password=access2008

The scenario that I want to take place:

If user enters password
Then use password entered
Else if user does not enter password
then use the password in memory

Does anyone know the code for this?

Thanks,
REMGU



Sponsored Link
Ads by Google

Response Number 1
Name: Elinor
Date: September 16, 2008 at 12:17:51 Pacific
Reply:

Hi,

Not sure what you mean.
How about:


@echo off
set inmemory=access2008
set /P passwd=Please enter password: || set passwd=%inmemory%
echo Password: %passwd%
pause > NUL

hth,

Elinor

Elinor Hurst
http://elinorhurst.blogspot.com


0

Response Number 2
Name: IVO
Date: September 16, 2008 at 12:24:43 Pacific
Reply:

set userPWD=
set /P userPWD=Enter Password or hit ENTER^>
if not defined userPWD set userPWD=%password%


0

Response Number 3
Name: remgu
Date: September 16, 2008 at 13:25:59 Pacific
Reply:

Thank you both! Elinor, that is exactly what I was looking for.

Thanks,
REMGU


0

Response Number 4
Name: remgu
Date: September 19, 2008 at 13:53:08 Pacific
Reply:

Elinor, what if the password is not stored locally but is actually called from another file?

Thanks,
REMGU


0

Response Number 5
Name: Elinor
Date: September 20, 2008 at 10:56:46 Pacific
Reply:

Hi Remgu,

If the password is simply stored in another file you can use something like:


@echo off
set /P passwd=Please enter password: || set /P passwd=<passwd.txt
echo Password: %passwd%
pause > NUL

hth,

Elinor

Elinor Hurst
http://elinorhurst.blogspot.com


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

Batch: Read file repeated... batch file help



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Use entered password, else use stor

Batch file to enter password protec www.computing.net/answers/programming/batch-file-to-enter-password-protec/16637.html

Help with C++ password program www.computing.net/answers/programming/help-with-c-password-program/20312.html

Anyone use MediaBASIC? www.computing.net/answers/programming/anyone-use-mediabasic/11250.html