AT commands: why does it not work?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
tinfanide
Posts: 117
Joined: 05 Sep 2011 09:15

AT commands: why does it not work?

#1 Post by tinfanide » 15 Jan 2013 06:05

Code: Select all

at 00:00 /interactive "echo hi"

Why does it not work?

But if:

Code: Select all

at 00:00 "cmd /c echo something > C:\something.txt"

It works.

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: AT commands: why does it not work?

#2 Post by Ed Dyreen » 15 Jan 2013 07:51

tinfanide wrote:

Code: Select all

at 00:00 /interactive "echo hi"

Why does it not work?
I am not convinced it works or not as the evidence for that conclusion is missing. Try

Code: Select all

at 00:00 /interactive "echo hi &pause"

tinfanide
Posts: 117
Joined: 05 Sep 2011 09:15

Re: AT commands: why does it not work?

#3 Post by tinfanide » 21 Jan 2013 01:48

Code: Select all

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Windows\system32>at 15:47 /interactive "echo hi &pause"
Warning: Due to security enhancements, this task will run at the time
expected but not interactively.
Use schtasks.exe utility if interactive task is required ('schtasks /?'
for details).
Added a new job with job ID = 1

C:\Windows\system32>


Same result.

shirulkar
Posts: 40
Joined: 15 Jan 2013 23:53

Re: AT commands: why does it not work?

#4 Post by shirulkar » 21 Jan 2013 04:06

At does not automatically load Cmd.exe, the command interpreter. If you are not running an executable (.exe) file, you must explicitly load CMD at the beginning of the command e.g. cmd /c dir
Don’t try to pass more than one command into AT, put multiple commands into a batch file and then call the batch file from AT.

also by default only a Local Administrator can issue an AT command, a Domain Admin can direct the command at any machine.
To configure an AT job as part of a users login script - the user must be a member of the local Administrators group.

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: AT commands: why does it not work?

#5 Post by Ed Dyreen » 21 Jan 2013 04:29

Hi tinfanide, thanks for the evidence removing all doubt :)
tinfanide wrote:

Code: Select all

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Windows\system32>at 15:47 /interactive "echo hi &pause"
Warning: Due to security enhancements, this task will run at the time
expected but not interactively.
Use schtasks.exe utility if interactive task is required ('schtasks /?'
for details).
Added a new job with job ID = 1

C:\Windows\system32>


Same result.
Well it works, but not interactively. It is true that you can use schtasks as well to plan your tasks but there are differences.
AT can run under system account interactive, but obviously not on your newer not XP OS :?
shirulkar wrote:At does not automatically load Cmd.exe, the command interpreter. If you are not running an executable (.exe) file, you must explicitly load CMD at the beginning of the command e.g. cmd /c dir
I strongly doubt this and certainly not true for XP !

ed

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: AT commands: why does it not work?

#6 Post by foxidrive » 21 Jan 2013 04:56

Ed Dyreen wrote:
shirulkar wrote:At does not automatically load Cmd.exe, the command interpreter. If you are not running an executable (.exe) file, you must explicitly load CMD at the beginning of the command e.g. cmd /c dir
I strongly doubt this and certainly not true for XP !

ed


It doesn't work in XP, but it lets you create the job without authenticating the command. The lower 'Error' part is the status after it was supposed to run, it did nothing.

Code: Select all

c:\>at 21:54 /interactive "echo hi &pause"
Added a new job with job ID = 1

c:\>at
Status ID   Day                     Time          Command Line
----------------------------------------------------------------------
Error   1   Tomorrow                21:54 PM      "echo hi &pause"

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: AT commands: why does it not work?

#7 Post by Ed Dyreen » 21 Jan 2013 05:12

'
I do not doubt that as I've never planned raw batch commands. I doubt what you quoted, and that statement stands.
When running raw batch commands, then use cmd /c, but otherwise not necessary.

Code: Select all

cmd /c "echo hi &pause"
or
myBatch.CMD
First two posts will fail I see that now, but will be planned.

Regards

Post Reply