48u
Goto Top

Hilfe mit meiner kleinen Batchdatei.

Bei: SET /p YesNo="Do you want to delete your Normal.dot now (J/N?) ? "

Hallo ich bin ein immernoch ein Anf�nger mit Bat Dateien, nun habe ich gedachte schreibe ich mal eine Bat datei, die die Normal.dot l�scht! Dies klappt auch schon wunderbar auch das mit dem if exist funktionoiert! das einzige was nicht funktioniert, ist wenn man
bei der zeile: SET /p YesNo="Do you want to delete your Normal.dot now (J/N?) ? "
J oder N eingibt, also egal was, kommt man immer zu no1!!! Anstatt zu Yes1!
Kann mir wer helfen?
Hier noch der Code!

@echo off
echo ****************************
echo *                                                    *
echo *  Execution of Normal.dot            *
echo *                                                    *
echo ****************************
echo.
echo Are you sure you want to delte your Normal.dot ? 
echo All your Word Settings will be LOST and the
echo default settings will be restored.
SET /p YesNo="Do you want to delete your Normal.dot now (J/N?) ?  
IF /i "!YesNo!"=="J" goto yes1  
 ) ELSE (
goto no1
)
:yes1
if exist "C:\Documents and Settings\%username%\Application Data\Microsoft\Vorlagen\normal.dot" goto delete  
goto ende
:delete
del "C:\Documents and Settings\%username%\Application Data\Microsoft\Vorlagen\normal.dot"  
echo Normal.dot was succesfully delted!
pause
exit
:ende
echo Normal.dot does not exist!
pause
exit
:no1
echo NEIN??
pause

Und danke f�r die Hilfe shconmal

Content-Key: 23589

Url: https://administrator.de/contentid/23589

Printed on: April 24, 2024 at 02:04 o'clock

Member: n4426
n4426 Jan 14, 2006 at 20:19:20 (UTC)
Goto Top
Hi,

ersetz mal die Zeile
IF /i "!YesNo!"=="J" goto yes1
durch
IF /i %YesNo%=="J" goto yes1


mfg

n4426
Member: tom-k
tom-k Jan 14, 2006 at 20:20:22 (UTC)
Goto Top
nicht:
IF /i "!YesNo!"=="J" goto yes1

versuchs mal mit:
IF /i %YesNo%=="J" goto yes1

nimm den Teil:
) ELSE (
goto no1
)
heraus und setze statt dessen:
goto no1

8-)
Member: 48u
48u Jan 14, 2006 at 20:26:08 (UTC)
Goto Top
@echo off
echo ****************************
echo *                          *
echo *  Execution of Normal.dot *
echo *                          *
echo ****************************
echo.
echo Are you sure you want to delte your Normal.dot ? 
echo All your Word Settings will be LOST and the
echo default settings will be restored.
SET /p YesNo="Do you want to delete your Normal.dot now (J/N?) ?  
IF /i %YesNo%=="J" goto yes1  
goto no1

:yes1
if exist "C:\Documents and Settings\%username%\Application Data\Microsoft\Vorlagen\normal.dot" goto delete  
goto ende

:delete
del "C:\Documents and Settings\%username%\Application Data\Microsoft\Vorlagen\normal.dot"  
echo Normal.dot was succesfully delted!
pause
exit

:ende
echo Normal.dot does not exist!
pause
exit

:no1
echo No...
pause

so hab das beides gemacht was ihr gesagt habt, aber es geht torzdme nich ^^

EDIT:

habs hingekriegt!!!

diese zeile hab ich folgendermassen geändert:

vorher: IF /i %YesNo%=="J" goto yes1
nacher: IF /i "%YesNo%"=="J" goto yes1
Member: daniel-t
daniel-t Jan 15, 2006 at 00:26:58 (UTC)
Goto Top
Ich würde vorher prüfen ob Normal.dot vorhanden ist...
schade dass choice.exe nicht mehr dabei ist...

IF EXIST ...goto nichtda in einer Zeile!


cls
@echo off
echo
echo * *
echo * Execution of Normal.dot *
echo * *
echo
echo.
IF EXIST "%userprofile%\Application Data\Microsoft\Vorlagen\Normal.dot" (goto abfrage) ELSE goto nichtda

:abfrage
echo.
echo Are you sure you want to delte your Normal.dot?
echo All your Word Settings will be LOST and the
echo default settings will be restored.
echo.
ECHO Do you want to DELETE your Normal.dot now (J for yes)
@set /p JN= J/N?
@if %JN%==J goto loesch
@if not %JN%==J goto ende


:loesch
echo.
del "%userprofile%\Application Data\Microsoft\Vorlagen\Normal.dot"
@set /p = Normal.dot deleted...press button
exit /b

:nichtda
echo.
echo Normal.dot not found...
echo.
echo check if file exists
echo in %userprofile%\Application Data\Microsoft\Vorlagen\
echo good bye!
echo.
pause
exit /b

:ende
echo.
echo aborted...good bye!
echo.
pause
exit /b


achso hat schon geklappt...wohl zu spät habs überlesen...