Forum

> > Off Topic > Batch File Problem
Forums overviewOff Topic overviewLog in to reply

German Batch File Problem

4 replies
To the start Previous 1 Next To the start

old Batch File Problem

ez-crow
User Off Offline

Quote
Hallo, ich habe da ein Problem mit meiner Batch File.
Wisst ihr wo das Problem hier liegt:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
@echo off
:main

echo.
echo TEXT
echo.

set /p x=

if %x%==test1 goto s1
if %x%==test2 goto main

if not %x%==test1 goto main
if not %x%==test2 goto main


:s1

echo.
echo TEXT
echo.

set /p x=

if %x%==test3 goto s3

if not %x%==test4 goto s4

:s3

echo.
echo TEXT
echo.
echo.
pause

:s4

echo.
echo TEXT
echo.
echo.
pause

eigentlich sollte ich nach dem ich bei s1 den Text eingegeben haben zu s3/s4 kommen. Aber stattdessen schließt sich das Programm.

mfg

old Re: Batch File Problem

Nova
User Off Offline

Quote
bei mir macht das Programm das, was du ihm auch gesagt hast.

Du könntest die ersten vier if-Teile vereinfachen, indem du das schreibst:
1
2
if %x%==test1 goto s1
if not %x%==test1 goto main
Das ist kürzer und macht das selbe.

Mach mal einen Screenshot des Fensters, in dem du die Texte eingibst beim letzten Schritt, bevor es sich beendet.

old Re: Batch File Problem

ez-crow
User Off Offline

Quote
habe das problem gefunden. es liegt daran:

1
2
if %x%==Hier sind Leerzeichen goto s3
if not %x%==Hier sind Leerzeichen goto s4

die leerzeichen im text sind das problem warum es nicht funktioniert. weiß vielleicht jemand wie man das umgeht?

old Re: Batch File Problem

Nova
User Off Offline

Quote
Versuch die Texte in Anführungsstriche zu setzen. Also " oder '
Kenne mich in Batch nicht so aus, aber funktioniert vielleicht.
To the start Previous 1 Next To the start
Log in to replyOff Topic overviewForums overview