Computer Hope

Microsoft => Microsoft DOS => Topic started by: Lukelumia800 on November 18, 2012, 07:37:00 AM

Title: Batch file problem: is not expected at this time/moment
Post by: Lukelumia800 on November 18, 2012, 07:37:00 AM
Hello,
i have a problem with a batch file. i om working for this code 2 ours, its not finished yet.
but when i start the file, it does everything but when it comes to the middle. it stops, like "exit"
i put --------------------- on the last punt it shows

the code:
Code: [Select]
@echo off
:beveiliging1
if not exist "%appdata%\.minecraft\accounts" goto first_startup_settings
if exist "%appdata%\.minecraft\accounts" goto beveiliging2

:first_startup_settings
title First startup instalation
md %appdata%\.minecraft\accounts
md %appdata%\.minecraft\accounts\accounts
md %appdata%\.minecraft\accounts\settings
md %appdata%\.minecraft\accounts\minecraft
echo Instalation is succesfully finished
pause
del "first_startup"
goto beveiliging2

:beveiliging2
if not exist "%appdata%\.minecraft\accounts\name.txt" goto start2
if exist "%appdata%\.minecraft\accounts\name.txt" goto start3

:start2
set name=!missing!
goto beveiliging3

:start3
title minecraft username veranderen.
for /f "Delims=" %%a in (%appdata%\.minecraft\accounts\name.txt) do (

set name=%%a

)
goto beveiliging3

:beveiliging3
if exist "%appdata%\.minecraft\accounts\minecraft\minecraftlocation.txt" goto menu
if not exist "%appdata%\.minecraft\accounts\minecraft\minecraftlocation.txt" goto beveiliging3_1

:beveiliging3_1
cls
echo copy and paste the locations of the following things,
echo if you don't use some of those
echo download it, ore say none
echo as exemple of mincraft: C:\Users\%random%\AppData\Roaming\.minecraft
echo.
set /p mineshafter__location=copy and paste te location of mineshafter:
set /p minecraftsp__location=copy and paste te location of minecraftsp:
set minecraft_location=%appdata%\.minecraft\minecraft.exe
if %mineshafter__location%==none goto break_1
set mineshafter_location=%mineshafter__location%\mineshafter-proxy.jar
if %minecraftsp__location%==none goto break_2
set minecraftsp_location=%minecraftsp__location%\minecraftsp.jar
goto beveiliging3_3

:break_1
set mineshafter_location=none
goto beveiliging3_2

:break_2
set minecraftsp_location=none
goto beveiliging3_3

:beveiliging3_2
cls
if %minecraftsp__location%==none goto beveiliging3_3
set minecraftsp_location=%minecraftsp__location%\minecraftsp.jar
goto beveiliging3_3

:beveiliging3_3
cls
echo this is ride?
echo %mineshafter_location%
set /p beveiliging3_3_1=Yes/No :
if %beveiliging3_3_1%==No goto exit_reload
if %beveiliging3_3_1%==Yes goto beveiliging3_4
goto beveiliging3_3

:beveiliging3_4
echo %mineshafter_location% > "%appdata%\.minecraft\accounts\minecraft\mineshafterlocation.txt"
cls
echo this is ride?
echo %minecraftsp_location%
set /p beveiliging3_3_2=Yes/No :
if %beveiliging3_3_2%==No goto exit_reload
if %beveiliging3_3_2%==Yes goto beveiliging3_4_0
goto beveiliging3_4

:beveiliging3_4_0
echo %minecraftsp_location% > "%appdata%\.minecraft\accounts\minecraft\minecraftsplocation.txt"
echo %minecraft_location% > "%appdata%\.minecraft\accounts\minecraft\minecraftlocation.txt"
goto menu

:menu

for /f "Delims=" %%c in (%appdata%\.minecraft\accounts\minecraft\minecraftlocation.txt) do (

set minecraft_loc=%%c

)

for /f "Delims=" %%d in (%appdata%\.minecraft\accounts\minecraft\minecraftsplocation.txt) do (

set minecraftsp_loc=%%d

)
for /f "Delims=" %%e in (%appdata%\.minecraft\accounts\minecraft\mineshafterlocation.txt) do (

set mineshafter_loc=%%e

)
pause
if %minecraftsp_loc%==none set minecraftsp_loc=""
if %mineshafter_loc%==none set mineshafter_loc="'
pause
goto menu_start

:menu_start
title minecraft username veranderen. nu actief: %name%
cls
echo naar wie wil je veranderen?
set /p keuze= Hoe heet de avatar:
if exist "%appdata%\.minecraft\accounts\accounts\%keuze%" goto a
if not exist "%appdata%\.minecraft\accounts\accounts\%keuze%" goto b

:a
copy "%appdata%\.minecraft\accounts\accounts\%keuze%" "%appdata%\.minecraft\lastlogin%"
if exist "%appdata%\.minecraft\accounts\accounts\%keuze%_minecraft" start %appdata%\.minecraft\minecraft.exe
if exist "%appdata%\.minecraft\accounts\accounts\%keuze%_mineshafter" start %
echo %keuze% > "%appdata%\.minecraft\accounts\name.txt"
pause
goto beveiliging1

:b
cls
echo wat gebruik je?
set /p keuze2= minecraft of mineshafter:
if %keuze2%== minecraft start %appdata%\.minecraft\minecraft.exe
if %keuze2%== mineshafter start C:\Users\luke\Documents\Bureaublad\minecraft\Minecraft\mineshafter-proxy.jar
pause
cls
echo typ je naam en wachtwoord in %keuze2% en login
echo.
pause
cls
echo als je dat gedaan hebt, en je bent ingelogd
echo sluit %keuze2%
pause
cls
echo gelukt?
set /p keuze3= ja/nee:
if %keuze3%== ja goto c
if %keuze3%== nee goto b
pause
exit

:c
copy "%appdata%\.minecraft\lastlogin" "%appdata%\.minecraft\accounts\accounts\%keuze%"

goto menu

:exit_reload
echo pleas restart this application
pause
exit
[/size]

here a small version where it goes rong:
Code: [Select]
:menu

for /f "Delims=" %%c in (%appdata%\.minecraft\accounts\minecraft\minecraftlocation.txt) do (

set minecraft_loc=%%c

)

for /f "Delims=" %%d in (%appdata%\.minecraft\accounts\minecraft\minecraftsplocation.txt) do (

set minecraftsp_loc=%%d

)
for /f "Delims=" %%e in (%appdata%\.minecraft\accounts\minecraft\mineshafterlocation.txt) do (

set mineshafter_loc=%%e

)
pause
if %minecraftsp_loc%==none set minecraftsp_loc=""
if %mineshafter_loc%==none set mineshafter_loc="'
pause
goto menu_start

:menu_start
title minecraft username veranderen. nu actief: %name%
cls
echo naar wie wil je veranderen?
set /p keuze= Hoe heet de avatar:
if exist "%appdata%\.minecraft\accounts\accounts\%keuze%" goto a
if not exist "%appdata%\.minecraft\accounts\accounts\%keuze%" goto b

or view on: http://mibpaste.com/btsa0N

thank you
Title: Re: Batch file problem: is not expected at this time/moment
Post by: foxidrive on November 18, 2012, 08:05:23 AM
Try wrapping these in double quotes - there could be long filename elements in the paths that need them.


"%minecraftsp_loc%"

"%appdata%\.minecraft\accounts\minecraft\minecraftlocation.txt"

set "minecraftsp_loc=%%d" and the other variables.

if "%minecraftsp_loc%"=="none" set minecraftsp_loc=""
Title: Re: Batch file problem: is not expected at this time/moment
Post by: Lukelumia800 on November 18, 2012, 11:26:23 AM
Wouw, It works thank you for command me
Thank you very much
Title: Re: Batch file problem: is not expected at this time/moment
Post by: Lukelumia800 on November 18, 2012, 01:29:40 PM
now i have an other problem,
on the same file.

the code:
Code: [Select]
:menu

for /f "Delims=" %%c in (%appdata%\.minecraft\accounts\minecraft\minecraftlocation.txt) do (

set minecraft_loc=%%c

)

for /f "Delims=" %%d in (%appdata%\.minecraft\accounts\minecraft\minecraftsplocation.txt) do (

set minecraftsp_loc=%%d

)
for /f "Delims=" %%e in (%appdata%\.minecraft\accounts\minecraft\mineshafterlocation.txt) do (

set mineshafter_loc=%%e

)
if "%minecraftsp_loc%"=="none" set minecraftsp_loc2=""
if "%mineshafter_loc%"=="none" set mineshafter_loc2="'
if not "%minecraftsp_loc%"=="none" set minecraftsp_loc2=minecraftsp
if not "%mineshafter_loc%"=="none" set mineshafter_loc2=mineshafter
goto menu_start

:menu_start
title minecraft username changing. now active: %name%
cls
echo How calls the username you wanne use?
set /p keuze= Username:
if exist "%appdata%\.minecraft\accounts\accounts\%keuze%" goto a
if not exist "%appdata%\.minecraft\accounts\accounts\%keuze%" goto b

:a
for /f "Delims=" %%d in (%appdata%\.minecraft\accounts\minecraft\%keuze%_start.txt) do (

set start_fenster=%%d

)
copy "%appdata%\.minecraft\accounts\accounts\%keuze%" "%appdata%\.minecraft\lastlogin%"
if exist "%appdata%\.minecraft\accounts\accounts\%keuze%_minecraft" start %appdata%\.minecraft\minecraft.exe
if exist "%appdata%\.minecraft\accounts\accounts\%keuze%_mineshafter" start %
echo %keuze% > "%appdata%\.minecraft\accounts\name.txt"
start %%start_fenster%_log%
pause
goto beveiliging1

at onn of the least lines "start %%start_fenster%_log% how can i fix this, so it works
%start_fenster% comes from a text file
%..._log% is the location

i need to make the location again, or is is possible to make 2 %...% togetter 1 output

thank you
Title: Re: Batch file problem: is not expected at this time/moment
Post by: foxidrive on November 18, 2012, 10:27:02 PM
I think this is what you want.  Also, when you double quote the term you also need to provide empty double quotes after the start command - as that is an empty title command.

start "" "%start_fenster%%_log%"