Need help with AT.exe, windows NT task scheduler

aceO07

Diamond Member
Nov 6, 2000
4,491
0
76
I'm trying to set up a few tasks for the scheduler on Windows NT Server. There is no fancy gui to accomplish this, at least none that I have found and I don't really want to another program on the server.

Here is what I want to execute:
FOR /F "tokens=2,3,4* delims=/ " %a IN ('date /t') do echo Date: %a-%b-%c >> system.log

I tried typing:
AT 17:00 /INTERACTIVE "cmd /c FOR /F "tokens=2,3,4* delims=/ " %a IN ('date /t') do echo Date: %a-%b-%c >> system.log".

It's supposed to output the date to the system.log file. However that doesn't work. It just gives the status "error". I tried a few other minor changes to that line too, but nothing really work. Any ideas?

 

oog

Golden Member
Feb 14, 2002
1,721
0
0
put the command you want to execute into a batch file and schedule that instead?
 

aceO07

Diamond Member
Nov 6, 2000
4,491
0
76
Originally posted by: oog
put the command you want to execute into a batch file and schedule that instead?

Unfortunately, that command I want to execute doesn't seem to work in a batch file either. If you just write that line twice in a batch file it will cause errors. OR possible even if it was just once.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
If you just write that line twice in a batch file it will cause errors

That's because things like variable access are slightly different in batch files as opposed to running them straight from cmd. But I don't know the specifics because I've avoided them as much as possible, sorry.
 

aceO07

Diamond Member
Nov 6, 2000
4,491
0
76
Is there a way of passing exact parameters to a command, without using quotes?

Here is what I want
at.exe 10:20 /interactive C:\WINNT\SYSTEM32\CMD.EXE /C FOR /F "tokens=2,3,4* delims=/ " %a IN ('date /t') do echo Date %a-%b-%c > d:\system.log

However, there is no way of getting all of the command parameter into the at.exe program since it thinks the output should be sent directly to system.log, which is infact part of the command I want to be execute. I could put quotes around the command string, however, it does not work properly in creating any output file.
 

aceO07

Diamond Member
Nov 6, 2000
4,491
0
76
To clarify..

This command:
at.exe 10:20 /interactive C:\WINNT\SYSTEM32\CMD.EXE /C FOR /F "tokens=2,3,4* delims=/ " %a IN ('date /t') do echo Date %a-%b-%c > d:\system.log
will create a schedule for FOR /F "tokens=2,3,4* delims=/ " %a IN ('date /t') do echo Date %a-%b-%c
The schedule is missing the >d:\system.log portion, since the system thinks I want to redirect the output.. :p

I can force the exact command string by placing quotes around it,
at.exe 10:20 /interactive "C:\WINNT\SYSTEM32\CMD.EXE /C FOR /F "tokens=2,3,4* delims=/ " %a IN ('date /t') do echo Date %a-%b-%c > d:\system.log"
HOWEVER, then it will not execute, since "C:\WINNT\SYSTEM32\CMD.EXE /C FOR /F "tokens=2,3,4* delims=/ " %a IN ('date /t') do echo Date %a-%b-%c > d:\system.log" is not a program or command, it's just a long string.
 

Woodie

Platinum Member
Mar 27, 2001
2,747
0
0
First off...it'll have to go into a batch file: (test.bat)

@echo off
FOR /F "tokens=2,3,4* delims=/ " %%a IN ('date /t') do echo Date %%a-%%b-%%c > c:\system.log

at 10:20 /interactive c:\test.bat


See...it wasn't so hard! :D
 

aceO07

Diamond Member
Nov 6, 2000
4,491
0
76
Originally posted by: Woodie
First off...it'll have to go into a batch file: (test.bat)

@echo off
FOR /F "tokens=2,3,4* delims=/ " %%a IN ('date /t') do echo Date %%a-%%b-%%c > c:\system.log

at 10:20 /interactive c:\test.bat

See...it wasn't so hard! :D

Thanks! Is it because of the echo off in the batch file? or the double %? I know I've tried batch files before. And it would complain about the variables.
 

Woodie

Platinum Member
Mar 27, 2001
2,747
0
0
double %'s... echo off is so it doesn't write the commands to the screen, just the result of them. In this case, nothing.