|
Answer» I NEED to make a batch command which enters the date and time in a file. The actual batch file contains:
Code: [Select]date/t >"E:\Maraddata\Tingö\puc.txt" time/t >>"E:\Maraddata\Tingö\puc.txt" But using the ö, MS-Dos don't recognize it. Anybody who can help me o create this text file with date and time in this "Tingö" folder???
Note that the command is running at a server with Win2003 installed. cmd.exe recognizes the ö charachter the PROBLEM is your using quotations
This works.. date/t >E:\Maraddata\Tingö\puc.txt time/t >>E:\Maraddata\Tingö\puc.txt
This Doesnt.. date/t >"E:\Maraddata\Tingö\puc.txt" time/t >>"E:\Maraddata\Tingö\puc.txt
I expect you didn't try it in a batch file. Because it doesn't work...
Executing the batch file, the results:
Code: [Select]E:\Maraddata\Tingö>date/t >E:\Maraddata\Ting÷\puc.txt The system cannot find the path specified.
E:\Maraddata\Tingö>time/t >>E:\Maraddata\Ting÷\puc.txt The system cannot find the path specified. Please note the ÷ INSTEAD of the ö
I see what you mean, ok .. i played around with it for a while and this is what i CAME up with
@echo off cd\ if not exist %systemdrive%\maraddata mkdir %systemdrive%\maraddata cd %systemdrive%\maraddata for /f "tokens=1*" %%a in ('dir /a:d ting* /b') do cd %%a date/t >.\puc.txt time/t >>.\puc.txtif the tingö folder exists it will work, otherwise create it manually first from the lineThank you!
But...
When I execute the batch file from the command line, no problem. But if the batch-file is executed by another process (a mail-client software program), i get the following: (I removed the @echo off)
Code: [Select]C:\Documents and Settings\Administrator>cd\
C:\>cd E:\Maraddata
C:\>for /f "tokens=1*" %%a in ('dir /a:d ting* /b') do cd %%a File not found
C:\>date/t 1>.\toc.txt
C:\>time/t 1>>.\toc.txt ?and Tingö folder existsthe folder wasnt found because the folder didnt change, try this instead
cd\maraddata for /f "tokens=1*" %%a in ('dir /a:d ting* /b') do cd %%a date/t >.\puc.txt time/t >>.\puc.txt
Still not succeeded.
I can change the folder WITHIN the C-drive. But I failed to switch over to my E-drive oh, sorry i didnt realize E: wasnt your systemdrive,
HEres another way
E: cd\maraddata\ting? date/t>.\puc.txt time/t>>.\puc.txt Right! Thanks, it works!no problem and welcome to the forums
|