xplayer2005
Goto Top

BatchDatei, Ziffern 0-9 in Datei schreiben geht nicht.

Hallo,

ich möchte eine Tastatureingeabe in eine Datei umleiten, das habe ich auch hinbekommen, funktioniert leider nicht mit den ziffen 0-9.
dabei bleibt die Tatei leer, bzw. bei 1 ergibt sich noch die Besonderheit das "ECHO is off." in die Datei geschrieben wird.
ab der Ziffer 10 funzt es einwandfrei. Ich kann mit nicht erklären wiso. wenn ich versuche die 0-9 im Code direkt (an statt der variable) anzugeben gehts auch nicht.

hier ein Ausschnitt meines codes:

ECHO.
ECHO.
set /p zautdate=please type the number of days the files should be older then
ECHO %zautdate%>C:\WINDOWS\system32\lominputdays.txt
ECHO.
ECHO ---------------------------------------------------
ECHO The days for the autodeletion was set to %zautdate%
ECHO ---------------------------------------------------
ECHO.
ECHO.


das komische ist ja:

please type the number of days the files should be older then ::wird ausgegeben und auf die tastatureingebe gewartet
z.B. die 8 wird eingegeben
dann wird versucht die 8in die .txt zu schreiben ----- was leider nicht kpappt die .txt bleibt leer
jetzt geb ich die variable noch auf den Bildschirm aus und die 8 erscheint...


für Tipps bedanke ich mich schon jetz

was noch wichtig wäre: das skript leuft auf xp

Content-Key: 43306

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

Printed on: April 20, 2024 at 00:04 o'clock

Member: Biber
Biber Oct 30, 2006 at 08:39:06 (UTC)
Goto Top
Moin and morning, xplayer2005,

leider I can not write in outlandish as well as you do, but I will do my very best.
What is not much.

I would recommend to instruct your users to choose a number of days greater 4 because the numbers 0 to 4 have an ambigous meaning in the CMD environment.

Or, alternatively to write
ECHO %zautdate%1>C:\WINDOWS\system32\lominputdays.txt
-or-
>C:\WINDOWS\system32\lominputdays.txt ECHO %zautdate%
-or-
to use the FFSF.

Best regards
Beaver

P.S.
für Tipps bedanke ich mich schon jetz
Would be nice anyway to set this thread on "Solved" when finished. Thx.
Member: xplayer2005
xplayer2005 Oct 30, 2006 at 09:03:01 (UTC)
Goto Top
Thanx for your fast help, unfortunately it doesn't work but you bring me on the right way,


ECHO %zautdate%1>C:\WINDOWS\system32\lominputdays.txt

was not ok because when i type an 8 i put an 81 in the file

ECHO >C:\WINDOWS\system32\lominputdays.txt ECHO %zautdate%

does't work because the ECHO is in the file too

but without the echo it works.. thank you
Member: xplayer2005
xplayer2005 Oct 30, 2006 at 09:05:36 (UTC)
Goto Top
sorry,

the echo was my fault

your advice is great
Member: Biber
Biber Oct 30, 2006 at 09:11:33 (UTC)
Goto Top
...the other one goes on my cap,
ECHO %zautdate%1>whatever
will only work with a SPACE between %zoutdate% and %1.
ECHO %zautdate% 1>whatever
...is similar to..
ECHO %zautdate% >whatever
..but you'll have this additional space with your whatever-file.

Another alternative would be..
(ECHO %zautdate%)>whatever
...without this trailing blank.

HTH
Biber