Question

Hide Password Input

Asked by: palserv

Hello,

i want to hide hide password input in batch called alot of isql procedure i have an example below but i need to hide password input.

when you start the bacth it call for password , i want to hide input.

Regards

@ECHO OFF
 
rem setting the date variable for the Logfiles
 
FOR /F "TOKENS=1 DELIMS=/ " %%d IN ('DATE/T') DO SET DD=%%d
FOR %%A IN (%Date:/=%) DO SET Today=%%A 
set /P pwd=Password: 
@echo ##################################################################
@echo #                                       Script Done By Sybase DBA's                                        #
@echo #                                         Press "Y" To Run The Script                                         #
@echo ##################################################################
 
@echo off
set Verify=
set /p Verify=Are You Sure You Want To Run The Batch[Y/N]?
if /i not "%Verify%"=="Y" (echo Script cancelled & goto :eof)
 
isql -Usa -P%pwd% -Ssybase -iD:\Documents\Scripts\Batches\batch1.txt -oD:\Documents\Scripts\Batches\batch1%dd%_%today%.txt
isql -Usa -P%pwd% -Ssybase -iD:\Documents\Scripts\Batches\batch2.txt -oD:\Documents\Scripts\Batches\batch2%dd%_%today%.txt
isql -Usa -P%pwd% -Ssybase -iD:\Documents\Scripts\Batches\batch3.txt -oD:\Documents\Scripts\Batches\batch3%dd%_%today%.txt
isql -Usa -P%pwd% -Ssybase -iD:\Documents\Scripts\Batches\batch4.txt -oD:\Documents\Scripts\Batches\batch4%dd%_%today%.txt
 
pause

                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-09-07 at 12:13:36ID24713227
Tags

msdos

,

windows

,

batch

,

sql

Topics

MS DOS

,

Sybase Database

,

Microsoft Windows Operating Systems

Participating Experts
4
Points
500
Comments
23

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Hide drives & and "subst" command
    How can I hide drives in explorer, like winhacker, and how can I "subst" a directory with delphi code? Twin Cam
  2. password hiding
    I am trying to hide the text in a textbox with *** when a password is entered ... any ideas?
  3. DOS Batch variable in isql
    Is it possible to pass a DOS batch variable like a database name into an isql script. For example could I pass my variable "%1" into the create database command (isql> create database "%1"....) to automatcially create a database name as specified in th...
  4. password for isql
    Hi all, I am new on sybase, I forgot isql sa password, how can I connect isql ? any way to change unknown password? any files? any methods? is there any equivalent of svrmgrl Oracle for Sybase? thanks all. hakan
  5. hide application
    How to hide mya application from the services list and from the toolbar using both windows 2000, XP or 9x plataform ?

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: t0t0Posted on 2009-09-07 at 13:18:38ID: 25277070

Try this:

@ECHO OFF
 
rem setting the date variable for the Logfiles
 
FOR /F "TOKENS=1 DELIMS=/ " %%d IN ('DATE/T') DO SET DD=%%d
FOR %%A IN (%Date:/=%) DO SET Today=%%A 
 
set /P .=Password: <nul
echo wscript.echo CreateObject("ScriptPW.Password").GetPassword() >getpsw.vbs
for /f %%a in ('cscript //nologo "getpsw.vbs"') do set pwd=%%a
 
echo.
@echo ##################################################################
@echo #                                       Script Done By Sybase DBA's                                        #
@echo #                                         Press "Y" To Run The Script                                         #
@echo ##################################################################
 
@echo off
set Verify=
set /p Verify=Are You Sure You Want To Run The Batch[Y/N]?
if /i not "%Verify%"=="Y" (echo Script cancelled & goto :eof)
 
isql -Usa -P%pwd% -Ssybase -iD:\Documents\Scripts\Batches\batch1.txt -oD:\Documents\Scripts\Batches\batch1%dd%_%today%.txt
isql -Usa -P%pwd% -Ssybase -iD:\Documents\Scripts\Batches\batch2.txt -oD:\Documents\Scripts\Batches\batch2%dd%_%today%.txt
isql -Usa -P%pwd% -Ssybase -iD:\Documents\Scripts\Batches\batch3.txt -oD:\Documents\Scripts\Batches\batch3%dd%_%today%.txt
isql -Usa -P%pwd% -Ssybase -iD:\Documents\Scripts\Batches\batch4.txt -oD:\Documents\Scripts\Batches\batch4%dd%_%today%.txt
 
pause

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:

Select allOpen in new window

 

by: dragon-itPosted on 2009-09-07 at 13:24:38ID: 25277089

Well..... short answer is no.  You could use a VBScript with some complex code like this:

http://www.edugeek.net/forums/coding/6951-masking-password-inputbox-vbscript.html

(Pqassword function that calls IE half way down). or mask it a little by changing screen colours, e.g. with a bit of fiddling you can make a small popup for entering using just batch:

@echo off
Echo Please enter your password in the popup window and then press enter
set tempbat="%temp%\p.cmd"

REM Create temporary batch file to make popup window for entering password 'masked'
echo mode 20,1 >%tempbat%
echo color 01 >>%tempbat%
echo Title Enter Password >>%tempbat%
echo setlocal enabledelayedexpansion >>%tempbat%
echo set /p Pass= >>%tempbat%
echo echo !pass!^>"%temp%\pass.txt" >>%tempbat%
echo exit >>%tempbat%
echo exit >>%tempbat%

start /wait "" %tempbat%

set /p Password=<"%temp%\pass.txt"
echo The password is %password%

 

by: dragon-itPosted on 2009-09-07 at 13:28:59ID: 25277117

Which incorporated in your script is:

@ECHO OFF
rem setting the date variable for the Logfiles
 
FOR /F "TOKENS=1 DELIMS=/ " %%d IN ('DATE/T') DO SET DD=%%d
FOR %%A IN (%Date:/=%) DO SET Today=%%A
call :getpassword
@echo ##################################################################
@echo #                                       Script Done By Sybase DBA's                                        #
@echo #                                         Press "Y" To Run The Script                                         #
@echo ##################################################################
 
@echo off
set Verify=
set /p Verify=Are You Sure You Want To Run The Batch[Y/N]?
if /i not "%Verify%"=="Y" (echo Script cancelled & goto :eof)
 
isql -Usa -P%pwd% -Ssybase -iD:\Documents\Scripts\Batches\batch1.txt -oD:\Documents\Scripts\Batches\batch1%dd%_%today%.txt
isql -Usa -P%pwd% -Ssybase -iD:\Documents\Scripts\Batches\batch2.txt -oD:\Documents\Scripts\Batches\batch2%dd%_%today%.txt
isql -Usa -P%pwd% -Ssybase -iD:\Documents\Scripts\Batches\batch3.txt -oD:\Documents\Scripts\Batches\batch3%dd%_%today%.txt
isql -Usa -P%pwd% -Ssybase -iD:\Documents\Scripts\Batches\batch4.txt -oD:\Documents\Scripts\Batches\batch4%dd%_%today%.txt
 
pause
exit /b

:getpassword
Echo Please enter your password in the popup window and then press enter
set tempbat="%temp%\p.cmd"

REM Create temporary batch file to make popup window for entering password 'masked'
echo mode 20,1 >%tempbat%
echo color 01 >>%tempbat%
echo Title Enter Password >>%tempbat%
echo setlocal enabledelayedexpansion >>%tempbat%
echo set /p Pass= >>%tempbat%
echo echo !pass!^>"%temp%\pass.txt" >>%tempbat%
echo exit >>%tempbat%
echo exit >>%tempbat%

start /wait "" %tempbat%
del %tempbat% 2>NUL

set /p Pwd=<"%temp%\pass.txt"
del "%temp%\pass.txt" 2>NUL


t0t0 - I can't get the VBScript version to work... maybe it is my Windows 2000 or IE6 on there that is preventing the easy option (I was trying my version while you had already posted of course, sorry).

 

by: dragon-itPosted on 2009-09-07 at 13:30:52ID: 25277128

From a google this is in XP onwards... bout time I rebuilt this machine me thinks!

Steve

 

by: oBdAPosted on 2009-09-07 at 15:11:14ID: 25277510

Not so short answer is "yes"; just don't use any of the following characters in the password: ! < > & % ^ |
I've taken the liberty of moving the verify in front of the password query.

@echo off
setlocal
rem setting the date variable for the Logfiles
 
FOR /F "TOKENS=1 DELIMS=/ " %%d IN ('DATE/T') DO SET DD=%%d
FOR %%A IN (%Date:/=%) DO SET Today=%%A 
@echo ##################################################################
@echo #                                       Script Done By Sybase DBA's                                        #
@echo #                                         Press "Y" To Run The Script                                         #
@echo ##################################################################
 
@echo off
set Verify=
set /p Verify=Are You Sure You Want To Run The Batch[Y/N]?
if /i not "%Verify%"=="Y" (echo Script cancelled & goto :eof)
 
set InputTitle=Enter Password:
set InputResult=%Temp%\%~n0-Input.tmp
reg add "HKCU\Console\%InputTitle%" /v "CursorSize"       /t REG_DWORD /d "100"      /f >NUL 2>&1
reg add "HKCU\Console\%InputTitle%" /v "FaceName"         /t REG_SZ    /d "Terminal" /f >NUL 2>&1
reg add "HKCU\Console\%InputTitle%" /v "FontFamily"       /t REG_DWORD /d "48"       /f >NUL 2>&1
reg add "HKCU\Console\%InputTitle%" /v "FontSize"         /t REG_DWORD /d "1048588"  /f >NUL 2>&1
reg add "HKCU\Console\%InputTitle%" /v "FontWeight"       /t REG_DWORD /d "400"      /f >NUL 2>&1
reg add "HKCU\Console\%InputTitle%" /v "ScreenBufferSize" /t REG_DWORD /d "196638"   /f >NUL 2>&1
reg add "HKCU\Console\%InputTitle%" /v "ScreenColors"     /t REG_DWORD /d "136"      /f >NUL 2>&1
reg add "HKCU\Console\%InputTitle%" /v "WindowPosition"   /t REG_DWORD /d "24904160" /f >NUL 2>&1
reg add "HKCU\Console\%InputTitle%" /v "WindowSize"       /t REG_DWORD /d "196638"   /f >NUL 2>&1
echo Please enter the Sybase password in the popup window "%InputTitle%"
start "%InputTitle%" /wait "%ComSpec%" /v:on /c "echo.&set /p Input= &echo !Input!>"%InputResult%""
for /f "delims=" %%a in ('type "%InputResult%"') do set pwd=%%a
del "%InputResult%"
reg delete "HKCU\Console\%InputTitle%" /f >NUL 2>&1
 
isql -Usa -P%pwd% -Ssybase -iD:\Documents\Scripts\Batches\batch1.txt -oD:\Documents\Scripts\Batches\batch1%dd%_%today%.txt
isql -Usa -P%pwd% -Ssybase -iD:\Documents\Scripts\Batches\batch2.txt -oD:\Documents\Scripts\Batches\batch2%dd%_%today%.txt
isql -Usa -P%pwd% -Ssybase -iD:\Documents\Scripts\Batches\batch3.txt -oD:\Documents\Scripts\Batches\batch3%dd%_%today%.txt
isql -Usa -P%pwd% -Ssybase -iD:\Documents\Scripts\Batches\batch4.txt -oD:\Documents\Scripts\Batches\batch4%dd%_%today%.txt
 
pause

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:

Select allOpen in new window

 

by: t0t0Posted on 2009-09-07 at 15:39:58ID: 25277648

oBdA

Neat! I can see it's uses....

 

by: t0t0Posted on 2009-09-07 at 15:43:41ID: 25277661

Personally, I would remove the following line of code:

   echo Please enter the Sybase password in the popup window "%InputTitle%"

It's not needed. It just adds clutter.

 

by: AbqBillPosted on 2009-09-07 at 17:50:55ID: 25278064

Another (simpler) alternative is my editv32/editv64 utility:

http://www.westmesatech.com/editv.html

It has a "-m" parameter that lets you hide (mask) the typed input, and it stores the typed input into an environment variable. Bill.

 

by: palservPosted on 2009-09-09 at 01:48:02ID: 25289288

oBdA & t0t0 thanks alot for your support,

can we user stars ****** instead of nothing written?

 

by: oBdAPosted on 2009-09-09 at 01:53:18ID: 25289304

Not with my solution, sorry, that's why I used a large font and a block cursor.
The input is hidden by using the same color for background and foreground, but with plain batch, it's impossible to change the output that "set /p" generates.

 

by: dragon-itPosted on 2009-09-09 at 02:48:04ID: 25289533

which is why I suggested either using a very similar color blue on black so pretty well hidden in a pop up windows (similar idea but without registry entry bit) or to use vbscript as suggested?
The other thing  thought is change to using Symbol font

 

by: AbqBillPosted on 2009-09-09 at 07:57:19ID: 25291952

Hi palserv, editv32/editv64 displays "*" when you use the -m parameter. Bill.

 

by: t0t0Posted on 2009-09-09 at 08:44:44ID: 25292474

editv32 and editv64 are not native to the OS - they are third-party programs which means the batch file would not be partable to other machines unless they also have these third-party programs installed.

 

by: AbqBillPosted on 2009-09-09 at 08:49:40ID: 25292519

Yes, that's true, but they were specifically designed to address this specific problem and are easier to use and simpler to implement than the other suggested workarounds. This is usually a non-issue unless a company policy specifically prohibits third-party applications. You can typically put a copy of editv32/editv64 in the same directory as the shell script (the term "batch file" is rather antiquated) and call the executable that way. Bill.

 

by: t0t0Posted on 2009-09-09 at 09:16:25ID: 25292793

Admittedly, Editv presents itself as a nice tool and one which I'm yet to add to my toolbox. For a one-off solution I can see it being the preferred choice. In some establishments it is better to just get the job done and if Editv does this with minimal maintenance then that's a bonus as far as time, expense and debugging time is concerned.

As I haven't used it myself, I'm not sure whether it displays anything as you type in password mode.

I like the length-limiting option as well as the time-out option.

All these have their uses in certain circumstances.

I presume Editv32 and Editv64 are written in both 32-bit and 64-bit native code....

I think I read somewhere, it can convert to upper-case and that it can validate numerical input too. Unfortuantely, it did not do the opposite - convert to lower-case and validate to just letters of the alphabet - or am I thinking of another program?...

 

by: AbqBillPosted on 2009-09-09 at 10:18:22ID: 25293468

EditV32/EditV64 displays '*' characters instead of the typed input if the '-m' parameter is present. It can convert to upper-case but not lower-case, and it can allow numeric-only input but not alphabetic-only. Alphabetic-only input is more complicated than you might think due to localization. In fact, as the code is written right now, the "force to uppercase while typing" option only works on lowercase English characters. I may change this to "uppercase after the fact" instead of "uppercase while typing" and use an international-friendly uppercase function if there's a demand, and if I do that, lowercase is just as easy. Bill.

 

by: t0t0Posted on 2009-09-09 at 11:21:54ID: 25294086

Bill, you make it sound as though you're the author of Editv.... Are you?

 

by: AbqBillPosted on 2009-09-09 at 12:29:34ID: 25294701

Yes. However, I need to qualify my earlier comments. Localization is more complicated than I initially remembered because of the MS-DOS versions of the EditVar and Choose programs. The uppercase feature is going to stay as-is for the time being, because it's a bit of work to make it work on alphabets other than English. Bill.

 

by: dragon-itPosted on 2009-09-09 at 12:30:06ID: 25294707

Just to add another into the mix.... here is one I have on my website and forgot about:

http://www.dragon-it.co.uk/links/info.htm  Password.exe down the bottom.

 

by: dragon-itPosted on 2009-09-09 at 12:30:25ID: 25294709

but better off with the new 32/64 bit utils!

 

by: AbqBillPosted on 2009-09-09 at 12:38:45ID: 25294777

Hi dragon-it, I originally started with that method (create a temporary batch file and depend on the user to call the batch file and delete it when finished), but now I simply write the variable to the environment. (This was tricky in the Windows 32-bit and 64-bit worlds.) Bill.

 

by: dragon-itPosted on 2009-09-21 at 09:46:43ID: 25384847

palserv - Did you try any of these out at all or where we all just chatting amongst ourselves?  Perhaps you could at the solutions given to your question and accept the answer(s) you wish...

 

by: palservPosted on 2009-09-23 at 00:36:37ID: 25400708

Hello,

sorry for delay , i think I'll go to oBdA solution , but i waiting confirmation about that
please hold on.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...