Go Back   Computer Forums > General Computing > Programming
Join Computer forums Today

Thread Tools Search this Thread Display Modes
Old 07-09-2007, 11:48 PM   #1
Solid State Member
Join Date: Jul 2007
Posts: 16
Default Batch Script Bug

I have the following Batch Script:
@echo off
echo. && set /p MO=Enter the password:
if /i "%MO%"=="123123" (
goto Run
echo Invalid Input
timeout 5
goto start
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


XylexRayne is offline   Reply With Quote
Old 07-31-2007, 01: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


if [variable] == null


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

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 11:47 AM.

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