What's wrong with my Batch Script?

Asia81

Yuri Lover ~
OP
Member
Joined
Nov 15, 2014
Messages
6,537
Trophies
3
Age
28
XP
2,826
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,

Zan'

2F88744FEED717856386400A44BBA4B9CA62E76A32C715D4F
Member
Joined
Oct 8, 2015
Messages
387
Trophies
0
Age
31
XP
261
Country
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
General chit-chat
Help Users
  • JuanMena @ JuanMena:
    Kissing random dudes choking in celery? Really? Need to study for that?
  • K3N1 @ K3N1:
    Yes it requires a degree
  • K3N1 @ K3N1:
    I could also yank out the rest of my teeth but theirs professionals for that
  • x65943 @ x65943:
    If your throat closes, putting oxygen in your mouth will not solve anything - as you will be introducing oxygen prior to the area of obstruction
  • JuanMena @ JuanMena:
    Just kiss me Kyle.
  • x65943 @ x65943:
    You either need to be intubated to bypass obstruction or create a stoma inferior to the the area of obstruction to survive
  • x65943 @ x65943:
    "Just kiss me Kyle." And I thought all the godreborn gay stuff was a smear campaign
  • JuanMena @ JuanMena:
    If I die, tell my momma I won't be carrying Baby Jesus this christmas :sad::cry:
  • K3N1 @ K3N1:
    Smear campaigns are in The political section now?
  • JuanMena @ JuanMena:
    Chary! Chary! Chary, Chary, Chary!
  • Sonic Angel Knight @ Sonic Angel Knight:
    Pork Provolone :P
  • Psionic Roshambo @ Psionic Roshambo:
    Sounds yummy
  • K3N1 @ K3N1:
    Sweet found my Wii u PSU right after I ordered a new one :tpi:
  • JuanMena @ JuanMena:
    It was waiting for you to order another one.
    Seems like, your PSU was waiting for a partner.
  • JuanMena @ JuanMena:
    Keep them both
    separated or you'll have more PSUs each year.
  • K3N1 @ K3N1:
    Well one you insert one PSU into the other one you get power
  • JuanMena @ JuanMena:
    It literally turns it on.
  • K3N1 @ K3N1:
    Yeah power supplies are filthy perverts
  • K3N1 @ K3N1:
    @Psionic Roshambo has a new friend
    +1
  • JuanMena @ JuanMena:
    It's Kyle, the guy that went to school to be a Certified man Kisser.
  • Psionic Roshambo @ Psionic Roshambo:
    Cartmans hand has taco flavored kisses
  • A @ abraarukuk:
    hi guys
  • Iron_Masuku @ Iron_Masuku:
    Hello
    Skelletonike @ Skelletonike: hmm