Author Topic: Why this doesn't work?  (Read 1091 times)

0 Members and 1 Guest are viewing this topic.

Offline Drax

  • Soldier
  • **
  • Posts: 241
Why this doesn't work?
« on: February 27, 2014, 01:59:35 am »
@echo off
title Password Generator
:MENU
cls
echo PASSWORD GENERATOR
echo ------------------
echo 1) Generate Password
echo 2) Exit
pause

this is what I copied from a guy on the internet and saved as soldat.bat and I run it and window opened but it shutdowns it self after it is done, it should wait for me to click something but it doesn't. how to fix it? ;/ PS I used notepad++

DarkCrusade

  • Guest
Re: Why this doesn't work?
« Reply #1 on: February 27, 2014, 08:50:00 am »
Try this:

Code: [Select]
@echo off
:Start2
cls
goto Start
:Start
title Password Generator
echo I will make you a new password.
echo Please write the password down somewhere in case you forget it.
echo ----------------------------------------­-----------------------
echo 1) 1 Random Password
echo 2) 5 Random Passwords
echo 3) 10 Random Passwords
echo Input your choice
set input=
set /p input= Choice:
if %input%==1 goto A if NOT goto Start2
if %input%==2 goto B if NOT goto Start2
if %input%==3 goto C if NOT goto Start2
:A
cls
echo Your password is %random%
echo Now choose what you want to do.
echo 1) Go back to the beginning
echo 2) Exit
set input=
set /p input= Choice:
if %input%==1 goto Start2 if NOT goto Start 2
if %input%==2 goto Exit if NOT goto Start 2
:Exit
exit
:B
cls
echo Your 5 passwords are %random%, %random%, %random%, %random%, %random%.
echo Now choose what you want to do.
echo 1) Go back to the beginning
echo 2) Exit
set input=
set /p input= Choice:
if %input%==1 goto Start2 if NOT goto Start 2
if %input%==2 goto Exit if NOT goto Start 2
:C
cls
echo Your 10 Passwords are %random%, %random%, %random%, %random%, %random%, %random%, %random%, %random%, %random%, %random%
echo Now choose what you want to do.
echo 1) Go back to the beginning
echo 2) Exit
set input=
set /p input= Choice:
if %input%==1 goto Start2 if NOT goto Start 2
if %input%==2 goto Exit if NOT goto Start 2

Offline Drax

  • Soldier
  • **
  • Posts: 241
Re: Why this doesn't work?
« Reply #2 on: February 27, 2014, 02:16:34 pm »
nvm I got it fixed,
how about this:
Uses CRT;

Const
 haslo='Pascal';

Var
 wprowadz:String;
 petla:byte;

Begin
  REPEAT
    ClrScr;
    GotoXY(31,12);
    Write('Podaj haslo : ');
    ReadLn(wprowadz);
    IF petla=4 THEN
    REPEAT
      ClrScr;
      GotoXY(31,12);
      Write('Access Denied !');
      Sound(3160);
      Delay(500);
      Sound(3190);
      Delay(500);
    UNTIL 1=2;
    petla:=petla+1;
  UNTIL wprowadz=haslo;
  { Haslo poprawne, dalsza część programu }
End.

how to save this in notepad++ in order to make this run properly?? I saved it with name.pas but it appears as a normal notepad file on the screen ;/
« Last Edit: February 27, 2014, 02:29:08 pm by Drax »

Offline Akinaro

  • Flagrunner
  • ****
  • Posts: 749
Re: Why this doesn't work?
« Reply #3 on: February 27, 2014, 02:35:31 pm »
First post look more like bat script for windows that generate random passwords, not soldat script...   :-\

Offline Drax

  • Soldier
  • **
  • Posts: 241
Re: Why this doesn't work?
« Reply #4 on: February 27, 2014, 03:19:20 pm »
well I know but it is related to soldat, because I am doing it to practice in order to learn scripting for soldat :D anyway I got the first one, look at the second one, but I think I am getting it fixed, it needs to be compiled :P

now when I went forward a little I get this error:

Current directory: D:\Pliki\trainingpro
CreateProcess() failed with error code 2:
The system cannot find the file specified.

================ READY ================

what does it mean? how to fix it?
« Last Edit: February 27, 2014, 03:50:00 pm by Drax »