What's wrong with my Batch Script?

  • Thread starter Thread starter Asia81
  • Start date Start date
  • Views Views 836
  • Replies Replies 2

Asia81

Yuri Lover ~
Member
Joined
Nov 15, 2014
Messages
6,900
Reaction score
4,468
Trophies
5
Age
32
XP
4,739
Country
France
Hi guys, here is my batch script :

Code:
@echo off
echo.
set /p S0=Y or N :
if /i %S0%==Y (SET %S1%=xutf) ELSE (SET %S1%=xtf)
3dstool.exe -%S1% exefs DecryptedExeFS.bin --exefs-dir ExtractedExeFS --header HeaderExeFS.bin
pause

Let's explain.

I the user anwser y, %S1% in the 3dstool line should be replaced with -xutf, if the user anwser n, %S1% should be replaced with -xtf.

But it's not working, no matter what I try, so where I'm wrong?
 
Last edited by Asia81,
Hi guys, here is my batch script :

Code:
@echo off
echo.
set /p S0=Y or N :
if /i %S0%==Y (SET %S1%=xutf) ELSE (SET %S1%=xtf)
3dstool.exe -%S1% exefs DecryptedExeFS.bin --exefs-dir ExtractedExeFS --header HeaderExeFS.bin
pause

Let's explain.

I the user anwser y, %S1% in the 3dstool line should be replaced with -xutf, if the user anwser n, %S1% should be replaced with -xtf.

But it's not working, no matter what I try, so where I'm wrong?

First of all I would suggest you start using quotation marks to prevent crashes.
And you can't set a variable like
%var%=X if it should be var=X
(Note: this can be used for pointers and similar things.)

Your fix would be looking like this
Code:
@echo off
echo.
set /p S0="Y or N : "
if /i "%S0%"=="Y" (SET S1=xutf) ELSE (SET S1=xtf)
3dstool.exe -%S1% exefs DecryptedExeFS.bin --exefs-dir ExtractedExeFS --header HeaderExeFS.bin
pause

However I would suggest you use CHOICE instead. Which would give you something like this:
Code:
@echo off
CHOICE /M "Do you want to decompress Code.bin? "
if "%errorlevel%"=="1" (SET par=xutf) ELSE (SET par=xtf)
3dstool.exe -%par% exefs DecryptedExeFS.bin --exefs-dir ExtractedExeFS --header HeaderExeFS.bin
pause
 
Last edited by Zan',
  • Like
Reactions: Asia81

Site & Scene News

Popular threads in this forum