?
Solved

Password as a argument

Posted on 2003-03-05
5
Medium Priority
?
308 Views
Last Modified: 2010-04-17
Dear all,
I am developing a console based application and it requires a password validation entry field. I want that password should not be printed in screen (rather some character should be displayed instead)
eg.
We have to pass the password as an argument in the following format:
c:\myexe  ps = ****** and then enter
where
myexe   is first argument ( name of my application)
ps=       is the second argument
the third argument is password AND THIS SHOULD BE IN CODED FORM eg. ********


Please comment!
0
Comment
Question by:replylalit
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 

Accepted Solution

by:
ZalexZ earned 100 total points
ID: 8070825
Do you want to start your exe from a batch??
I don't think its possible to hide chars in bat-files!

If you start your exe manually read the pwd extra:
C:\myexe
Please enter pwd:
Then you read every char with getch set cursor one pos back and write a *!

Regards
AZ
0
 
LVL 1

Expert Comment

by:spiritwithin
ID: 8070857
As far as i understood this correctly, you want to pass a password to an application by command line, without actually writing? That is not possible.

You can either encrypt the command line string or store the password encrypted in a temporary file.

Cheers.
0
 
LVL 1

Assisted Solution

by:sarda_ramesh
sarda_ramesh earned 100 total points
ID: 8071843
no the way u want it is not possibe .. because at commant prompt the commands we are giving are given to the shell and we cant change the shell like that .. as mentioned by ZalexZ u have to read the password like

enter ur passwd: ******

if u dont want to change the current exe u can write another program from where u can call ur exe .. the skelaton of the program will be like this ..

1. u will read the password (using getch() for example , so that the char u entered r not echoed and u can show * in place of them)

2. then u will call ur main exe like ..

strcpy(str,"myexe ");
strcat(str,password);

system(str);

hope it works

regards
ramesh
0
 

Expert Comment

by:CleanupPing
ID: 9447355
replylalit:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Six Sigma Control Plans
Starting up a Project

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question