Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 07-10-2007, 12:48 AM   #1
Solid State Member
 
Join Date: Jul 2007
Posts: 16
Default Batch Script Bug

I have the following Batch Script:
@echo off
:start
cls
echo. && set /p MO=Enter the password:
)
if /i "%MO%"=="123123" (
goto Run
)
:invalid
echo Invalid Input
timeout 5
goto start
:run
echo Password Worked
timeout 5
goto start

What should happen is when you login... it runs a program... the restarts so another user may do the same...

My problem is when the script restarts, there is a flaw.
You can press enter and It counts that as a pass.

I am trying to get these done before Wednesday
Thats why I have posted so many issues here....

Ive just gone around the without fixing them, canceling certain plans I had...

This time... There is no way around.. this flaw is my MAJOR hold back...

I am BEGGING for help. T..T

-Xylex
__________________

XylexRayne is offline   Reply With Quote
Old 07-31-2007, 02:44 AM   #2
Daemon Poster
 
RewtGuy's Avatar
 
Join Date: Dec 2004
Posts: 595
Send a message via AIM to RewtGuy
Default Re: Batch Script Bug

if batch has conditional statements or loops i'd do something like

while [variable]== null
{
EnterPassword();
}

or

if [variable] == null

exit(1);

Sorry, I code in c/c++. Those are my suggestions. Hopefully this helps. Not too sure of the batch equivalent.

EDIT: I just thought of something else, sometimes undefined variables do weird and random things. You could do something like

[variable]=0; then set the conditional statement / loop to equal 0 instead. This way if they don't input anything it stays the same. Of course the flaw is, if they enter 0 as the password it won't function properly. You could change it to anything you want, maybe something random or not on the keyboard like ƒ.
__________________
Windows: A thirty-two bit extension and GUI shell to a sixteen bit patch to an eight bit operating system originally coded for a four bit microprocessor and sold by a two-bit company that can't stand one bit of competition.
RewtGuy is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 05:43 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0