Computing.Net > Forums > Programming > Batch script check.

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch script check.

Reply to Message Icon

Name: LEoH
Date: April 29, 2009 at 01:19:07 Pacific
OS: Microsoft Windows XP Professional
CPU/Ram: 2.31 GHz / 3582 MB
Product: Gigabyte / M52s-s3p
Subcategory: Batch
Comment:

Hey,
I have written a few scripts in batch recently
and there are a few errors.
Could someone please do me a big favor and
help me correct these.
And could someone also please correct my
scripts, and explain were I went wrong. Or
what i could've done.

Here are my scripts.
With the first one (it is a login script) would it
be possible to make a 'user create' section
also, and be able to save it to an external file,
proferably encrypted that is compatible with
the login script and the login check on the
second.
With the second one (It is (going to be) a
bunch of scripts i have written in the past
added to a menu) there is a section (that i
wrote a bit differently because it was stand-
alone originaly, So it worked) called ICT
(internet connection test) which doesen't work.
It decides that my connection is always " "
rather than connected or disconnected. Could
someone please do me a favor and fix these.

@echo off
COLOR 0A
ECHO.PLEASE WAIT...
DEL /f /q *.tmp
CLS

:USERNME
ECHO.Please Type Login Username.
ECHO.
SET /p USERNME=:
CLS
ECHO.Please Type Login Password.
ECHO.
SET /p PASSWORD=:
GOTO %USERNME%
IF "%errorlevel%"=="1" GOTO
USERNMEERROR

:USERNMEERROR
ECHO.User: %USERNME% :Does Not Exist.
ECHO.Please Try Again.
ECHO.
GOTO USERNME

:Admin
SET USERNME=Administrator
if /i "%PASSWORD%"=="PWD" (
GOTO ADMINOPTIONS
) ELSE (
GOTO PASSWORDERROR
)

:Leoxalo
SET USERNME=Alexander Lewis
if /i "%PASSWORD%"=="PWD" (
GOTO CORRECTPASSBEGIN
) ELSE (
GOTO PASSWORDERROR
)

:Lewis
SET USERNME=Lewis Alexander
if /i "%PASSWORD%"=="PWD" (
GOTO CORRECTPASSBEGIN
) ELSE (
GOTO PASSWORDERROR
)

:PASSWORDERROR
CLS
ECHO.Password not accepted.
ECHO.Please Try Again.
ECHO.
GOTO USERNME

:ADMINOPTIONS
CLS
ECHO.Welcome Administrator.
ECHO.
ECHO.Please Select An Option From The
List:
ECHO.[a] Echo Out Password List
ECHO.[b] Secret User Service
ECHO.[c] Normal Options
SET /p AOPTION=Option:
if /i "%AOPTION%"=="a" GOTO ADMIN1
if /i "%AOPTION%"=="b" GOTO AO2
if /i "%AOPTION%"=="c" GOTO AO3
GOTO ADMINOPTIONS

:AO2
CLS
ECHO.Please Type Selected USERNME
SET /p USERNME=:
CLS
ECHO.Please Type Selected Password
SET /p PASSWORD=:
GOTO CORRECTPASSBEGIN

:AO3
GOTO CORRECTPASSBEGIN

:ADMIN1
CLS
ECHO.I-------------------------I
ECHO.I USERNME I Password I
ECHO.I_________________________I
ECHO.I Lewis I PWD I
ECHO.I Leoxalo I PWD I
ECHO.I_________________________I
PAUSE
GOTO ADMINOPTIONS
PAUSE

:CORRECTPASSBEGIN
CALL FINDER.cmd


Script 2 (Program Menu)


@echo off
COLOR 0A
ECHO.PLEASE WAIT...
if "%USERNME%"=="" (
GOTO USERERROR
) else (
GOTO BEGINMENU
)
:USERERROR
CLS
ECHO.A Sign In Error Occured.
ECHO.User Is Not Listed.
ECHO.
ECHO.Press Any Key To Exit
PAUSE >nul
EXIT

:BEGINMENU
COLOR 0A
CLS
if "%ERRORLEVEL%"=="1" (
SET ERROR=I
) else (
SET ERROR=-
)
ECHO.Welcome %USERNME%.
ECHO.
ECHO.Here Is A List Of Options Provided
ECHO.To Those Without Administrator Rights.
ECHO.
ECHO.
ECHO.[1] Document An Internet Search Of
ECHO. A Person On The Internet.
ECHO.
ECHO.[2] Open People Manager.
ECHO.
ECHO.[3] View All Possible Information
ECHO. About Your Computer.
ECHO.
ECHO.[4] Log Passwords.
ECHO.
ECHO.[5] Test Internet Connection.
ECHO.
ECHO.[6] Quit
ECHO.
ECHO.Warning. Some Options May Not Work
On
ECHO.Your Current Computer.
ECHO.
ECHO.Error Status: [%ERROR%]
set /p option=Please Select An Option:
IF "%option%"=="1" GOTO O1
IF "%option%"=="2" GOTO O2
IF "%option%"=="3" GOTO O3
IF "%option%"=="4" GOTO O4
IF "%option%"=="5" GOTO O5
IF "%option%"=="6" EXIT
SET ERRORLEVEL=1
GOTO BEGINMENU

:O1
SET ERRORLEVEL=1
GOTO BEGINMENU

:O2
SET ERRORLEVEL=1
GOTO BEGINMENU

:O3
SET ERRORLEVEL=1
GOTO BEGINMENU

:O4
SET ERRORLEVEL=1
GOTO BEGINMENU

:O5
CLS
@ECHO OFF
COLOR 5A
ECHO.Internet Connection Status: Testing
PING www.google.com.au >nul
if "%ERRORLEVEL%"=="1" (
SET ICS=1
) else (
SET ICS=0
)
CLS
if "ICS"=="1" SET ICSS=Disconnected
if "ICS"=="0" SET ICSS=Connected
ECHO.Internet Connection Status: %ICSS%
ECHO.
ECHO.Press Any Key To Return To The
Menu.
PAUSE >NUL
SET ERRORLEVEL=0
GOTO BEGINMENU

Thanks a billion,

LEoH
<i/>
OS:<



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch script check.

Batch Script Help Needed www.computing.net/answers/programming/batch-script-help-needed/14475.html

Batch Script Help www.computing.net/answers/programming/batch-script-help/15158.html

batch script to parse filenames www.computing.net/answers/programming/batch-script-to-parse-filenames/15286.html