Windows cli at command

Windows at command examples

At command, as the name indicates, can be used to schedule applications at specified time and date. This is a built-in command in Windows OS and does not require any separate software to be installed on the computer.

First thing you need to know is that At command requires Task Scheduler service to be running on the system. Otherwise you would get an error like below.

Let’s see few examples on how to use At command.

Schedule a task at a particular time

To schedule a task we just need to specify the time and the command for the task we need to run. For example, if you want to shutdown your computer at 11PM today then you can do this by running the below command.

Schedule a Recurrent Task

We can schedule tasks that run recurrently once in a week or once in a month. We can use /every switch for this purpose. Let’s say you want to automatically run defragmentation on one of the drives once in every week. This can be done by running the below command

After running this command system will initiate defragmentation on C: drive at 10 AM on every Monday.

See the tasks scheduled

We can see the list of scheduled tasks just by running At command without any parameters.

Schedule a task on some other day

We can use /next switch to schedule tasks for a different day. For example to run defragmentation on C: drive on next Thursday you can run the below command.

Schedule tasks to run every day

Using /every switch we can schedule a task to be run every day. For example to shutdown your computer automatically every day at 11PM you can create a task using the below command.

Delete Scheduled Tasks

We can delete scheduled tasks from the database by using /delete switch. We need to pass the id of the task we need to delete. We can see the id for each task by running At command without any parameters. For example to delete the task with the id 1 we need to run the below command.

I’m not sure if it’s related to the topic but I’ll ask anyway.
I need to get the exact location of a process name that a scheduled job is executing. I want to use WMIC JOB (if you have any other suggestions.. let me know) to get that, but I don’t know HOW exactly. I’ve tried several variations but no luck so far.
How should I do that?
I thought of direction like-
wmic job where name=”at2″ get command /value
but no luck.
Thanks in advance.

If it’s not the place to ask, tell me where can I ask.

BTW thanks for the article 🙂

I have tried this wmic command. It seems to be showing the jobs that are scheduled using at command. For the ones scheduled using the GUI task scheduler, it’s not showing any data and displays the message ‘No instance(s) available’.

You can try this command to get the command information.

Читайте также:  Создание пользователя linux adduser

wmic job where jobid=id get command

I have observed that name field is empty for the jobs scheduled using ‘at’. So you better use the job id. Or running ‘wmic job get command’ will show the commands for all the jobs currently running.

Why jobid=2? How can you be sure?
I want to know the command of a specific job that is not nessecerily running RIGHT NOW. I need it to check for every job exists.

wmic job get command shows “No Instance(s) Available”.
Same at “wmic job where jobid=2 get command”.

Thanks.
BTW Is that a new site running?

I have used 2 just as an example, you need to use the id of your job.
if you want to get it for every job, as I mentioned earlier, run the below command.
wmic job get command

Note that you need to run this from elevated administrator command prompt. otherwise you may get ‘no instance(s) available’ message.

How can I know the jobid? Problem is that I can’t know it (or am I wrong?).
The only thing I can know is the job’s name (‘at2’ for example). The WMIC JOB command need to be based on that.

I’ve tried as administrator (although UAC is disabled), same =\

wmic job shows the jobs that are running at that time.
you can get the job list using at command.

Oh.. so you mean I can forget about WMIC for what I need?

I’ve tried typing only ‘at’ command, all I got is “There are no entries in the list”, while I do have one (named at3). Even if I’ll manage to see the list, is there a way to get somehow only the command itself? (the process name)

I’d be glad for some answers 🙂
Thanks.

My previous replies have the answers.
First use at command to get the job id. If at command doesn’t show it, get it from scheduled tasks UI
Then use the below command.
wmic job where jobid=id get command
As mentioned earlier, this command will work only if the scheduled job is running at that time.

Ha! I got it finally.
Somewhy I haven’t pay attention to what you said earlier “It (WMIC command) seems to be showing the jobs that are scheduled using at command”.
Now I can be 100% sure I won’t need it unfortunately.

Thank you! 🙂
I guess I won’t bother you again with dumb questions… 😛

how would you make it run on log in
kinda’ like:
at login /every:M,T,W,TH,F,SA,SU start iexplore.exe (or any .exe/.bat)

I used the AT command on my Windows 7 OS but it is giving me “access denied” error message.

Run it from elevated administrator command prompt.

disable UAC and should work

Is it possible when running the “AT” command, to add a job name? As in – whenever the scheduled task is created, it creates the task with a job name of “At1” or “At2”, etc. Is there a way to specify what the scheduled task might be called?
– Chris

This is very late, but for the benefit of others having the same question, ‘At’ command does not provide a way to tag the command with a specific id. When we schedule a new task, it automatically tags them with ids like’at1′, ‘at2’, ‘at3’ and so.

Unfortunately this command seems to be deprecated in W10, replaced with some ugly schtasks or something, too bad I really liked the syntax of this one,

How to delete AT1 ,at1 ,at3,at4 .. etc… with command line and leave other windows task running

Читайте также:  Фишинг ссылка кали линукс

I tried with schtasks /delete /tn * /F then my all windows task got deleted , I want only AT tasks needs to deleted

What is Command Line Interface (CLI)?

CLI stands for:

  • Command Line Interface
  • Command Line Interpreter
  • Command Line Input

Command Line Input

CLI is a command line program that accepts text input to execute operating system functions.

In the 1960s, using only computer terminals, this was the only way to interact with computers.

In the 1970s an 1980s, command line input was commonly used by Unix systems and PC systems like MS-DOS and Apple DOS.

Today, with graphical user interfaces (GUI), most users never use command-line interfaces (CLI).

However, CLI is still used by software developers and system administrators to configure computers, install software, and access features that are not available in the graphical interface.

Examples

The software package manager npm uses command line input to install software:

Windows Example

Mac OS Example

You can navigate your folders (directories) with command line commands:

Windows Example

Use CLI commands with great attention.

Wrong use can easily delete files or destroy your computer system completely.

Basic Linux CLI Commands

Command Description
ls List the directory (folder) system.
cd pathname Change directory (folder) in the file system.
cd .. Move one level up (one folder) in the file system.
cp Copy a file to another folder.
mv Move a file to another folder.
mkdir Creates a new directory (folder).
rmdir Remove a directory (folder).
clear Clears the CLI window.
exit Closes the CLI window.
man command Shows the manual for a given command.

Basic Windows CLI Commands

Command Description
dir List the directory (folder) system.
cd pathname Change directory (folder) in the file system.
cd \ Move to the root folder of the file system.
cd .. Move one level up (one folder) in the file system.
copy Copy a file to another folder.
move Move a file to another folder.
type filename Type a file.
mkdir or md Creates a new directory (folder).
rmdir or rd Removes a directory (folder).
cls Clears the CLI window.
exit Closes the CLI window.
help command Shows the manual for a given command.

DOS Commands Help

You can display all available commands with the help command:

Example

ASSOC Displays or modifies file extension associations.
ATTRIB Displays or changes file attributes.
BREAK Sets or clears extended CTRL+C checking.
BCDEDIT Sets properties in boot database to control boot loading.
CACLS Displays or modifies access control lists (ACLs) of files.
CALL Calls one batch program from another.
CD Displays the name of or changes the current directory.
CHCP Displays or sets the active code page number.
CHDIR Displays the name of or changes the current directory.
CHKDSK Checks a disk and displays a status report.
CHKNTFS Displays or modifies the checking of disk at boot time.
CLS Clears the screen.
CMD Starts a new instance of the Windows command interpreter.
COLOR Sets the default console foreground and background colors.
COMP Compares the contents of two files or sets of files.
COMPACT Displays or alters the compression of files on NTFS partitions.
CONVERT Converts FAT volumes to NTFS. You cannot convert the current drive.
COPY Copies one or more files to another location.
DATE Displays or sets the date.
DEL Deletes one or more files.
DIR Displays a list of files and subdirectories in a directory.
DISKPART Displays or configures Disk Partition properties.
DOSKEY Edits command lines, recalls Windows commands, and creates macros.
DRIVERQUERY Displays current device driver status and properties.
ECHO Displays messages, or turns command echoing on or off.
ENDLOCAL Ends localization of environment changes in a batch file.
ERASE Deletes one or more files.
EXIT Quits the CMD.EXE program (command interpreter).
FC Compares two files or sets of files, and displays the differences between them.
FIND Searches for a text string in a file or files.
FINDSTR Searches for strings in files.
FOR Runs a specified command for each file in a set of files.
FORMAT Formats a disk for use with Windows.
FSUTIL Displays or configures the file system properties.
FTYPE Displays or modifies file types used in file extension associations.
GOTO Directs the Windows command interpreter to a labeled line in a batch program.
GPRESULT Displays Group Policy information for machine or user.
GRAFTABL Enables Windows to display an extended character set in graphics mode.
HELP Provides Help information for Windows commands.
ICACLS Display, modify, backup, or restore ACLs for files and directories.
IF Performs conditional processing in batch programs.
LABEL Creates, changes, or deletes the volume label of a disk.
MD Creates a directory.
MKDIR Creates a directory.
MKLINK Creates Symbolic Links and Hard Links.
MODE Configures a system device.
MORE Displays output one screen at a time.
MOVE Moves one or more files from one directory to another directory.
OPENFILES Displays files opened by remote users for a file share.
PATH Displays or sets a search path for executable files.
PAUSE Suspends processing of a batch file and displays a message.
POPD Restores the previous value of the current directory saved by PUSHD.
PRINT Prints a text file.
PROMPT Changes the Windows command prompt.
PUSHD Saves the current directory then changes it.
RD Removes a directory.
RECOVER Recovers readable information from a bad or defective disk.
REM Records comments (remarks) in batch files or CONFIG.SYS.
REN Renames a file or files.
RENAME Renames a file or files.
REPLACE Replaces files.
RMDIR Removes a directory.
ROBOCOPY Advanced utility to copy files and directory trees.
SET Displays, sets, or removes Windows environment variables.
SETLOCAL Begins localization of environment changes in a batch file.
SC Displays or configures services (background processes).
SCHTASKS Schedules commands and programs to run on a computer.
SHIFT Shifts the position of replaceable parameters in batch files.
SHUTDOWN Allows proper local or remote shutdown of machine.
SORT Sorts input.
START Starts a separate window to run a specified program or command.
SUBST Associates a path with a drive letter.
SYSTEMINFO Displays machine specific properties and configuration.
TASKLIST Displays all currently running tasks including services.
TASKKILL Kill or stop a running process or application.
TIME Displays or sets the system time.
TITLE Sets the window title for a CMD.EXE session.
TREE Graphically displays the directory structure of a drive or path.
TYPE Displays the contents of a text file.
VER Displays the Windows version.
VERIFY Tells Windows whether to verify that your files are written correctly to a disk.
VOL Displays a disk volume label and serial number.
XCOPY Copies files and directory trees.
WMIC Displays WMI information inside interactive command shell.
Читайте также:  Как просмотреть реестр windows

Command Help

For more information on a specific command, type help + command-name

Example

Displays or sets the date.

Type DATE without parameters to display the current date setting and
a prompt for a new one. Press ENTER to keep the same date.

If Command Extensions are enabled the DATE command supports
the /T switch which tells the command to just output the
current date, without prompting for a new date.

Оцените статью