Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1660
  • Last Modified:

Using the "AT" command, what is the syntax to run a task, now?

I thought it was something like at +1 "cmd.exe", but the syntax is wrong.  How can I create a one-off task to run asap?

Thanks,
Steve :)
0
sda100
Asked:
sda100
  • 3
  • 2
  • 2
  • +6
1 Solution
 
KaltiCommented:
I'm i little confused by your question, however, you can set it to run at a certain time 'AT 11:30 cmd.exe' will run cmd.exe at 11:30 of the current day, so just change the time to one minute away from the current time...

If you want to run a task 'now' then, you just run it, no real point in scheduling it?

If the task is already schduled, you will see it in Scheduled Tasks under control panel, where you can right click on it and click "Run" any time you like...
0
 
sda100Author Commented:
Oh, there is most definately a point for using AT... I want the program to run with SYSTEM privileges ;)

Rather than haivng to spend 3 secs and a bit of brain power to calculate the time, I just want to run it asap, which I'm pretty sure could be done with the AT command by specifying 1 minute ahead of NOW.  I just can't remember :(

Steve :)
0
 
KaltiCommented:
Ah, i see, well sorry mate, i have never heard of a way to do it and i just did a search around and couldn't find anything in any help documents for the command.

But, good luck, and if you find a way be sure to post it up :)
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
chris_bolCommented:
you could use soon.exe, see http://www.ss64.com/nt/soon.html fro the details.  I think it is on th eNT4 resource kit or downloadable from M$
0
 
sr1xxonCommented:
HI sda100,

I'm assuming that you are using a current version of windows (xp/2k/2k3)

you can set a scheduled task to run with a user account - an admin will have system priveleges.. it's probably easier to do this with the GUI than with the cmdline version: RUN NOW is an option when you set up the job schedule.

then if you need to fire the job again rather than by schedule, open the scheduled tasks folder and click 'run now'

when you create the job, you can enter advanced options - if this is for a monitoring job, you can use recurrence (eg run every 5 mins from 6am - 8pm or whenever, and kill if job doesn't end in, say, 4 minutes)

local security policy will tell you who can schedule tasks.. perhaps look there if a specific account isn't scheduling correctly.

:)
0
 
nexissteveCommented:
Hi,

http://www.robvanderwoude.com/index.html

Gives you all the details on the AT command. And yes it will run using the system account.

cheers

S
0
 
scrathcyboyCommented:
AT now + 1 minute run command.com
0
 
nexissteveCommented:
Depends on the OS

For XP it would be more like AT \\YOURMACHINE 9:15 /interactive CMD
0
 
IPKON_NetworksCommented:
If this is on Windows machine (as implied by the use of AT) then why not use the RUN AS command to initiate system privailages?
Alternatively, you can use the system variable for the current time which is %TIME%. Using a third party (or grep) tool, you can extract the hh:mm part and then add a couple of minutes to it, then push this variable into the AT command.

set fred = %TIME%
Set jon = LEFT$(%fred%,5)+1
at %jon% yourjob.exe

Does this make sense? The LEFT$ won't work in DOS btw. Just an example.

Barny
0
 
nexissteveCommented:
because you would have to know the system password to use the runas command
0
 
Dan McFaddenSystems EngineerCommented:
If you were to use the Task Scheduler, you could define a time to run the task at, and if for some reason you need to immediately execute the task, you can run it by right-clicking it and selecting 'run'
0
 
SunBowCommented:
Why not run the soon command? It too should have system privilege

C:\>soon

-----------------------------------
SOON  :  Command Scheduling Utility
-----------------------------------

Usage : SOON [\\computername] [delay] [/INTERACTIVE] "command"
   or : SOON /D [/L:n] [/R:n] [/I:{ON|OFF}]

delay : the number of seconds from now when the scheduled job should start.

   /D : modify Default settings and/or display their current values.
   /L : set LocalDelay - default delay for Local jobs - initially 5 seconds.
   /R : set RemoteDelay - default delay for Remote jobs - initially 15 seconds.
   /I : set InteractiveAlways option - initially OFF.

SOON schedules a job to run in the near future, a number of seconds from now.
SOON closely resembles the AT command because SOON simply runs a suitable AT
command. For a details of the other arguments run "AT /?" without the quotes.

Examples : SOON CMD /C C:\JOBS\BATCH.CMD
           SOON 10 CMD /C C:\JOBS\BATCH.CMD
           SOON \\SERVER 60 /C \JOBS\BATCH.CMD
           SOON \\SERVER /INTERACTIVE CMD /C C:\JOBS\BATCH.CMD
           SOON /d /l:2 /r:30 /i:on

Current Settings :     InteractiveAlways = OFF
                    LocalDelay (seconds) = 5
                   RemoteDelay (seconds) = 15
0
 
SunBowCommented:
closed
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
  • 2
  • 2
  • +6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now