1 for /F "tokens=2 delims=/"%%a in ('echo %date%') do set dom=%%a
2 if not exist d:\Logs\%dom% md d:\Logs\%dom%
3 set Loc=C:\Documents and Settings\config\Local Settings\Application
Data\Microsoft\Windows NT\NTBackup\data
4 if exist "%temp%\Backup.log" del "%temp%\Backup.log"
5 echo F | xcopy/d "%Loc%\*.log" "%temp%\Backup.log"
6 type %temp%\Backup.log > "d:\Logs\%dom%\Backup.log"
> Here is the batch file. First line errors as indicated above. We are
> using 2003 server. Thanks in advance for corrections/help - Bill
>
> 1 for /F "tokens=2 delims=/"%%a in ('echo %date%') do set dom=%%a
There's the lack of a space between " an %%a
If you type this at the CMD prompt, then use only single percent signs,
i.e., '%a' instead of '%%a'.
If it is a command in a batch file, then you need to double the percent
signs for '%a' (but not for '%date%').
Strange. On the actual command line on XP SP2 I get
C:\_M>for /F "tokens=1 delims=/" %a in ('echo %date%') do set dom=%a
C:\_M>set dom=20.04.2005
C:\_M>echo %dom%
20.04.2005
The second and the fourth line are by the computer, the first and the
third by the user.
Anoter:
C:\_M>for /F "tokens=2 delims=/" %a in ('echo %date%') do set dom=%a
C:\_M>echo %dom%
%dom%
All the best, Timo
--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/> ; FIN-65101, Finland
Useful script files and tricks ftp://garbo.uwasa.fi/pc/link/tscmd.zip