1.

Solve : Browse for installation directory !?

Answer»

I wanna make browse script in batch file working on win xp !
Something like ...
Code: [SELECT]Enter directory !!!
(user write this) X:\Games\
Press Y for Yes to countinue or N to CHOOSE other directory !then dir for installation is = to x:\games\ and installation begins !
Im new in this type of scripting and gimme example please ... other part of the script for "choosing" and ect. is done !
This MAY help you out:

Code: [Select]@echo off
:loop
set /p dir=Enter directory:
echo %dir%
set /p ans=Press Y for Yes to countinue or N to choose other directory !
if .%ans%==.Y goto next
if .%ans%==.y goto next
goto loop
:next

rest of your code GOES here

8-)Starting with echo off !
Code: [Select]@echo off
Thats work if its alone in BAT file !
Code: [Select]:start
echo --------------------------------------------------------------------
ECHO 1. Install in current directory !
ECHO 2. Browse !
ECHO 3. Exit !
echo --------------------------------------------------------------------
set /p choice=
set choice=What is your choise ?
if '%choice%'=='1' goto install
if '%choice%'=='2' goto loop
if '%choice%'=='3' goto exit
ECHO "%choice%" ERROR ... TRY 1 , 2 or 3 !
ECHO.
goto start
:install
@UHARC.exe x -pwproject project.uha
goto exit
Thats work if its alone too !
Code: [Select]:loop
echo Browse for install dir ... NOTE !!!
echo --------------------------------------------------------------------
echo If the path you want to use doesn't exist
echo the program will be installed in current dir
echo and the folder will be automaticaly created !
echo --------------------------------------------------------------------
set /p dir=Where to install:
echo %dir%
set /p ans=Press Y(Yes) to install or N(NO) to choose other dir !
if .%ans%==.y goto next
if .%ans%==.Y goto next
if .%ans%==.n goto loop
if .%ans%==.N goto loop
goto loop
:next
@UHARC.exe x -t%dir% -pwproject project.uha
@pause
Exit comand is here !
Code: [Select]:exit
@EXIT
Where do i wrong ?

Quote

UHARC comands
-t directory
example: -tproject
and -pw password
example: -pwproject
x=extract

When i merge this two scripts i recieve error !
"(choose... 1, 2, or 3) = 1 is was unexpected at this time."
I dont know where is the error , all seems to be correct but dont work !

P.S. Thank you for the help ... when your script is alone in the bat file works great !You never mentioned why the merged script failed to run, but you may have some luck with this:

Code: [Select]@echo off
:start
echo --------------------------------------------------------------------
ECHO 1. Install in current directory !
ECHO 2. Browse !
ECHO 3. Exit !
echo --------------------------------------------------------------------
set /p choice=What is your choice ?
if '%choice%'=='1' goto install
if '%choice%'=='2' goto loop
if '%choice%'=='3' goto exit
ECHO "%choice%" ERROR ... TRY 1 , 2 or 3 !
ECHO.
goto start

:install
@UHARC.exe x -pwproject project.uha
goto exit

:loop
echo Browse for install dir ... NOTE !!!
echo --------------------------------------------------------------------
echo If the path you want to use doesn't exist
echo the program will be installed in current dir
echo and the folder will be automaticaly created !
echo --------------------------------------------------------------------
set /p dir=Where to install:
echo %dir%
set /p ans=Press Y(Yes) to install or N(NO) to choose other dir !
if .%ans%==.y goto next
if .%ans%==.Y goto next
goto loop

:next
@UHARC.exe x -t%dir% -pwproject project.uha
:exit
8-)


Discussion

No Comment Found