[SOLVED] Prompt to enter password

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
demmnic
Posts: 8
Joined: 14 Aug 2012 12:09

[SOLVED] Prompt to enter password

#1 Post by demmnic » 14 Aug 2012 12:17

:META
"%PROGPATH%\unrar" e -o+ "%PROGPATH%\all.rar" "%PROGPATH%\" >NUL
IF %ERRORLEVEL%==0 FOR %%F IN ("%PROGPATH%\meta.txt") DO FOR /F %%D IN ("%%~tF") DO SET METAUP= meta always up-to-date.
GOTO Amenu

--------
The file "" all.rar "" protected by me with a password.

How do I customize the batch file so that first prompted to enter password.
Last edited by demmnic on 17 Aug 2012 01:36, edited 1 time in total.

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: Prompt to enter password

#2 Post by abc0502 » 14 Aug 2012 12:52

a prompt in a batch for input is like this:

Code: Select all

Set /P "input=Enter Password: "

The password will be stored in the varibale %input%

But in your case you are using a program "unrar", it must have a switch to take the password like 7z it has the switch "-p password" so you have two choices,
1> you add the password switch in your code follwed by the password.
2> add the above code in your batch "at the begining" and also add the switch of the password but followed by this "%input%"

demmnic
Posts: 8
Joined: 14 Aug 2012 12:09

Re: Prompt to enter password

#3 Post by demmnic » 14 Aug 2012 13:19

Edit by user
Last edited by demmnic on 15 Aug 2012 07:53, edited 1 time in total.

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: Prompt to enter password

#4 Post by abc0502 » 14 Aug 2012 13:59

the changes is in red
@echo off
cls
:: Prompt for password
Set /P "input=Enter Password: "


:::::::::::::::::::::::::::::: START MAP ACTIVATIE ::::::::::::::::::::::::::::::
:META
"%TEMP%\FastActivateMetaGet.exe" http://www.hallo.info/meta.rar /overwrite /output:"%PROGPATH%\meta.rar"
"%PROGPATH%\unrar" e -o+ -p "%input%" "%PROGPATH%\meta.rar" "%PROGPATH%\" >NUL
IF %ERRORLEVEL%==0 FOR %%F IN ("%PROGPATH%\meta.txt") DO FOR /F %%D IN ("%%~tF") DO SET METAUP=De geintegreerde meta is ten alle tijden up-to-date.
GOTO Amenu
:JUMPMAP
IF EXIST "%PROGPATH%\meta.txt" GOTO BACKBIF
IF NOT EXIST "%PROGPATH%\meta.txt" ECHO. & ECHO META.TXT niet gevonden! Voordat je gaat activeren eerst de meta.txt updaten! & ECHO. & PAUSE
IF NOT EXIST "%PROGPATH%\meta.txt" GOTO Amenu
:BACKBIF
IF EXIST \TTGO.ORI SET BIFFILE=TTGO.ORI
IF "%BIFFILE%"=="TTGO.ORI" GOTO JUMPBIF

IF EXIST \TTGO.BIF SET BIFFILE=TTGO.BIF
IF "%BIFFILE%"=="TTGO.BIF" GOTO JUMPBIF

IF EXIST \TTNAVIGATOR.BIF SET BIFFILE=TTNAVIGATOR.BIF
IF "%BIFFILE%"=="TTNAVIGATOR.BIF" GOTO JUMPBIF

:JUMPBIF
IF %BIFFILE%x==x ECHO. & ECHO TTGO.BIF of TTNAVIGATOR.BIF niet gevonden!! Kopieer TTIC_Activate.exe in de root van je Tomtom of SD kaart. & ECHO. & PAUSE
IF %BIFFILE%x==x GOTO Amenu

TYPE \%BIFFILE% | FIND "ApplicationVersionVersionNumber=" > %TEMP%\ApplicationVersionID.TXT
set /P ApplicationVersionID= < %TEMP%\ApplicationVersionID.TXT
IF "%ApplicationVersionID%x"=="x" GOTO APP1
rem ***** hiiteen 32 ekaa merkkii ja ota 10 vikaa *****
SET ApplicationVersionID=%ApplicationVersionID:~32,10%
GOTO APP2
:APP1
TYPE \%BIFFILE% | FIND "ApplicationVersion=" > %TEMP%\ApplicationVersionID.TXT
set /P ApplicationVersionID= < %TEMP%\ApplicationVersionID.TXT
rem ***** hiiteen 19 ekaa merkkii ja ota 10 vikaa *****
SET ApplicationVersionID=%ApplicationVersionID:~19,10%
:APP2
IF %ApplicationVersionID%==7451 SET KEYTYPE=8 & GOTO JUMP
IF %ApplicationVersionID%==7910 SET KEYTYPE=8 & GOTO JUMP
IF %ApplicationVersionID%==7915 SET KEYTYPE=8 & GOTO JUMP
IF %ApplicationVersionID%==7916 SET KEYTYPE=8 & GOTO JUMP
IF %ApplicationVersionID%==7917 SET KEYTYPE=8 & GOTO JUMP
IF %ApplicationVersionID%==7918 SET KEYTYPE=8 & GOTO JUMP
IF %ApplicationVersionID%==7900 SET KEYTYPE=8 & GOTO JUMP
IF %ApplicationVersionID%==7903 SET KEYTYPE=8 & GOTO JUMP
IF %ApplicationVersionID%==8010 SET KEYTYPE=8 & GOTO JUMP
If 8010 LSS %ApplicationVersionID% SET KEYTYPE=8 & GOTO JUMP
SET KEYTYPE=7 & GOTO JUMP
GOTO END
:JUMP
IF EXIST mymeta.txt copy "%PROGPATH%\meta.txt" + mymeta.txt "%PROGPATH%\meta.txt" & GOTO MYMETAON
IF NOT EXIST mymeta.txt ren "%PROGPATH%\meta.txt" meta.txt
:MYMETAON
COPY /y "%PROGPATH%\meta.txt" %ROOTDIR% >NUL

TYPE \%BIFFILE% | FIND "DeviceUniqueID" > %TEMP%\DeviceUniqueID.TXT
set /P DeviceUniqueID= < %TEMP%\DeviceUniqueID.TXT
rem ***** valit hiiteen *****
SET DeviceUniqueID=%DeviceUniqueID: =%
rem ***** ota vikat 10 merkkii *****
SET DeviceID=%DeviceUniqueID:~-10%

TYPE \%BIFFILE% | FIND "DeviceName" > %TEMP%\DeviceNameID.TXT
set /P DeviceNameID= < %TEMP%\DeviceNameID.TXT
rem ***** hiiteen 11 ekaa merkkii ja ota 80 vikaa *****
SET DeviceNameID=%DeviceNameID:~11,80%
CLS

I'm not sure if it will work or not if it didn't tell us

demmnic
Posts: 8
Joined: 14 Aug 2012 12:09

Re: Prompt to enter password

#5 Post by demmnic » 15 Aug 2012 03:27

Edit by user
Last edited by demmnic on 17 Aug 2012 01:29, edited 1 time in total.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Prompt to enter password

#6 Post by foxidrive » 15 Aug 2012 04:09

There is no image there.

demmnic
Posts: 8
Joined: 14 Aug 2012 12:09

Re: Prompt to enter password

#7 Post by demmnic » 15 Aug 2012 05:06

Please try again.

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Prompt to enter password

#8 Post by Squashman » 15 Aug 2012 06:04

demmnic wrote:Download file going well.

See sample:

http://www.4youshared.info/sample.png

Then batch stopped before unpacking.

You know it is possible to copy and paste text from the cmd window.

demmnic
Posts: 8
Joined: 14 Aug 2012 12:09

Re: Prompt to enter password

#9 Post by demmnic » 15 Aug 2012 06:34

edit by user
Last edited by demmnic on 15 Aug 2012 08:27, edited 1 time in total.

©opy[it]®ight
Posts: 60
Joined: 17 Mar 2012 09:59

Re: Prompt to enter password

#10 Post by ©opy[it]®ight » 15 Aug 2012 06:55

Are you trying to activate a TomTom map using some sort of patch? :mrgreen:

demmnic
Posts: 8
Joined: 14 Aug 2012 12:09

Re: Prompt to enter password

#11 Post by demmnic » 15 Aug 2012 07:07

Edit by user
Last edited by demmnic on 17 Aug 2012 01:32, edited 1 time in total.

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: Prompt to enter password

#12 Post by abc0502 » 15 Aug 2012 09:16

Ok try removing the double qoutes here :
-p "%input%"

If didn't work then remove the space between "-p" and "%input%"

demmnic
Posts: 8
Joined: 14 Aug 2012 12:09

Re: Prompt to enter password

#13 Post by demmnic » 15 Aug 2012 11:50

Sorry
Both options does not have any effect.

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: Prompt to enter password

#14 Post by abc0502 » 15 Aug 2012 11:51

ok first we will test it if it can take the password directlly from the batch use this
EDITED
I removed the space between the switch and the password

:META
"%TEMP%\FastActivateMetaGet.exe" http://www.hallo.info/meta.rar /overwrite /output:"%PROGPATH%\meta.rar"
"%PROGPATH%\unrar" e -o+ -ppassword "%PROGPATH%\meta.rar" "%PROGPATH%\" >NUL
IF %ERRORLEVEL%==0 FOR %%F IN ("%PROGPATH%\meta.txt") DO FOR /F %%D IN ("%%~tF") DO SET METAUP=De geintegreerde meta is ten alle tijden up-to-date.
GOTO Amenu
:JUMPMAP
IF EXIST "%PROGPATH%\meta.txt" GOTO BACKBIF
IF NOT EXIST "%PROGPATH%\meta.txt" ECHO. & ECHO META.TXT niet gevonden! Voordat je gaat activeren eerst de meta.txt updaten! & ECHO. & PAUSE
IF NOT EXIST "%PROGPATH%\meta.txt" GOTO Amenu
:BACKBIF
IF EXIST \TTGO.ORI SET BIFFILE=TTGO.ORI
IF "%BIFFILE%"=="TTGO.ORI" GOTO JUMPBIF

IF EXIST \TTGO.BIF SET BIFFILE=TTGO.BIF
IF "%BIFFILE%"=="TTGO.BIF" GOTO JUMPBIF

IF EXIST \TTNAVIGATOR.BIF SET BIFFILE=TTNAVIGATOR.BIF
IF "%BIFFILE%"=="TTNAVIGATOR.BIF" GOTO JUMPBIF

:JUMPBIF
IF %BIFFILE%x==x ECHO. & ECHO TTGO.BIF of TTNAVIGATOR.BIF niet gevonden!! Kopieer TTIC_Activate.exe in de root van je Tomtom of SD kaart. & ECHO. & PAUSE
IF %BIFFILE%x==x GOTO Amenu

TYPE \%BIFFILE% | FIND "ApplicationVersionVersionNumber=" > %TEMP%\ApplicationVersionID.TXT
set /P ApplicationVersionID= < %TEMP%\ApplicationVersionID.TXT
IF "%ApplicationVersionID%x"=="x" GOTO APP1
rem ***** hiiteen 32 ekaa merkkii ja ota 10 vikaa *****
SET ApplicationVersionID=%ApplicationVersionID:~32,10%
GOTO APP2
:APP1
TYPE \%BIFFILE% | FIND "ApplicationVersion=" > %TEMP%\ApplicationVersionID.TXT
set /P ApplicationVersionID= < %TEMP%\ApplicationVersionID.TXT
rem ***** hiiteen 19 ekaa merkkii ja ota 10 vikaa *****
SET ApplicationVersionID=%ApplicationVersionID:~19,10%
:APP2
IF %ApplicationVersionID%==7451 SET KEYTYPE=8 & GOTO JUMP
IF %ApplicationVersionID%==7910 SET KEYTYPE=8 & GOTO JUMP
IF %ApplicationVersionID%==7915 SET KEYTYPE=8 & GOTO JUMP
IF %ApplicationVersionID%==7916 SET KEYTYPE=8 & GOTO JUMP
IF %ApplicationVersionID%==7917 SET KEYTYPE=8 & GOTO JUMP
IF %ApplicationVersionID%==7918 SET KEYTYPE=8 & GOTO JUMP
IF %ApplicationVersionID%==7900 SET KEYTYPE=8 & GOTO JUMP
IF %ApplicationVersionID%==7903 SET KEYTYPE=8 & GOTO JUMP
IF %ApplicationVersionID%==8010 SET KEYTYPE=8 & GOTO JUMP
If 8010 LSS %ApplicationVersionID% SET KEYTYPE=8 & GOTO JUMP
SET KEYTYPE=7 & GOTO JUMP
GOTO END
:JUMP
IF EXIST mymeta.txt copy "%PROGPATH%\meta.txt" + mymeta.txt "%PROGPATH%\meta.txt" & GOTO MYMETAON
IF NOT EXIST mymeta.txt ren "%PROGPATH%\meta.txt" meta.txt
:MYMETAON
COPY /y "%PROGPATH%\meta.txt" %ROOTDIR% >NUL

TYPE \%BIFFILE% | FIND "DeviceUniqueID" > %TEMP%\DeviceUniqueID.TXT
set /P DeviceUniqueID= < %TEMP%\DeviceUniqueID.TXT
rem ***** valit hiiteen *****
SET DeviceUniqueID=%DeviceUniqueID: =%
rem ***** ota vikat 10 merkkii *****
SET DeviceID=%DeviceUniqueID:~-10%

TYPE \%BIFFILE% | FIND "DeviceName" > %TEMP%\DeviceNameID.TXT
set /P DeviceNameID= < %TEMP%\DeviceNameID.TXT
rem ***** hiiteen 11 ekaa merkkii ja ota 80 vikaa *****
SET DeviceNameID=%DeviceNameID:~11,80%
CLS

Last edited by abc0502 on 15 Aug 2012 11:57, edited 1 time in total.

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: Prompt to enter password

#15 Post by abc0502 » 15 Aug 2012 11:56

I was searching about the tool "unrar" it seems that it has problem with protected archives
is it ok to use the 7zip instead of the unrar to extract the files

Post Reply