• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Need help with AT.exe, windows NT task scheduler

aceO07

Diamond Member
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?

 
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.
 
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.
 
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.
 
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.. 😛

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.
 
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! 😀
 
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! 😀

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.
 
double %'s... echo off is so it doesn't write the commands to the screen, just the result of them. In this case, nothing.
 
Back
Top