Jump to content

Hidden User Input Prompt for batch file


Recommended Posts

Hi all,

I'm trying to automat the installation of office 2003 as much as possible.

Please view the below script to see how far I've gotten so far.

---------------------------- install.bat

cls

@echo off

echo Please Enter the Office 2003 license key, without the - seperator

SET /P prodkey=

setup.exe TRANSFORMS="Unattended.MST" /qb+ /l pidkey=%prodkey%

-----------------------------

This will prompt the user to enter a key, the only problem is that the license key the user enters remains visable on screen for the duration of the silent install. Is there a way to get input from the user, but to hide it in some way ? Such as when you type in your password in a form, its displayed as *********

Thanks in advance,

Remush

Link to comment
Share on other sites


Perhaps try this, but problem with the above code is there is no error control.


@Echo Off
CLS
Title Office 2003 Install
Mode 77,9
Color F9

Echo.
Echo Please Enter the Office 2003 license key, without the - seperator
SET /P prodkey=

CLS
Echo.
Echo Installing Office 2003 this will tale a few minutes to be completed.
setup.exe TRANSFORMS="Unattended.MST" /qb+ /l pidkey=%prodkey%

Here is a VBS script that will waits until the 25 characters for the key has

been enter. To close the script Inputbox without adding the key is to type

either exit or quit.

Save As Ofc2003Install.vbs


Dim UserIn
'-> Loop To Wait For The 25 Character Key
Do While Len(UserIn) < 25
UserIn = InputBox( _
"Enter in the Office 2003 license key." & vbcrlf & _
"Without using the - seperator" & vbcrlf & _
"Type Exit Or Quit to stop install" ,"Office Key Input","",,475)
'-> Quit Or Exit Case Insensitive
If InStr(1,UserIn,"quit",1) Or InStr(1,UserIn,"exit",1) Then
WScript.Quit(0)
End If
'-> Error To Few Characters
If Len(UserIn) =< 24 Then
MsgBox "The Needs To Be 25 Characters Not This Many : " & Len(UserIn),4128,"Error To Few Characters"
UserIn = ""
End If
'-> Correct Amount Of Characters, Start Install Office 2003
If Len(UserIn) = 25 Then
CreateObject("Wscript.Shell").Run("setup.exe TRANSFORMS=" & _
Chr(34) & "Unattended.MST" & Chr(34) & " /qb+ /l pidkey=" & UserIn),1,True
WScript.Quit(1)
End If
'-> Error To Many Characters
If Len(UserIn) >= 26 Then
UserIn = ""
MsgBox "To Many Characters Press Ok To Continue",4128,"Error To Many Characters"
End If
Loop

I have attach Ofc2003Install.vbs.txt just rename it to Ofc2003Install.vbs

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...