You are not logged in.

#1 02 Apr 2019 10:44

aaron77
New Member
Registered: 02 Apr 2019
Posts: 1

Help with batch file

Hi everyone, I wrote a very simple batch file, being that I'm new with if statements within batch i wanted to know how to correct this. I want my if statement to check if the user hasn't input anything and then provide a usage output. what did i do wrong?

@echo off
if "%1" == "" (
   echo Usage: %0 arg1
   exit /b
)
set /p option=Enter Username:
echo Your Username is %option%
echo Your secret Number is %random%
pause
cls
echo Thank you for using Joes Program %option% Enjoy your day!
pause

Offline

#2 02 Apr 2019 15:39

bluesxman
Member
From: UK
Registered: 29 Dec 2006
Posts: 1,129

Re: Help with batch file

You aren't actually doing anything with arg1 (%1), but other than that I can't see any errors.

Can you describe what it's doing/not doing that you're not happy with?

Last edited by bluesxman (02 Apr 2019 15:39)


cmd | *sh | ruby | chef

Offline

Board footer

Powered by