I've been trying to create a scheduled task from the command prompt. The task is created, but it runs hidden. Is there any way of running it in a non-hidden way? The process is very long and I would like to see what is going on...
I'm running it on a Vista, but the task is meant to run on pre-vista OS as well...
SCHTASKS /Create /RU \"NT AUTHORITY\SYSTEM\" /SC DAILY /ST 00:00 /TN Backup /TR \"C:\Sis\Backup\Backup.vbs\" /F /V1
Tks,
Filipe Scur
Running as NT AUTHORITY\SYSTEM means it is a system task and will run hidden.
Try run as a different username.
Related
SCHTASKS /create /S $strComputer /tn "David\Start Gecko" /tr
"'C:\eQube-Tools\Batch and Registry Files\gecko.bat'" /sc once /sd
01/01/2099 /st 01:00 /u Boss /p *password* /RU SYSTEM
pause
SCHTASKS /run /S $strComputer /tn "David\Start Gecko"
So, I have a problem with running the batch file this creates, it says it's running on the task scheduler on the remote pc, but nothing happens. But the odd thing is: if I locally create a "basic task" it runs fine both remotely and running it by hand at that pc.
My question is there any way to have it know you want to create a "basic task" I've looked at the switches but can't find anything for /create, I also tried the /xml but this is something I plan to create, use then destroy so simpler the better.
** the reason I'm using SCHtasks is because I had a lot of issues with redirect errors trying to run it directly using powershell.
Specs
All win 7 WORKGROUP
All have matching Admin Accounts with matching password
Firewall set to allow remote sch tasks
Batch file is on remote pc
the batch file I'm trying to run
#echo off
c:
cd \eQube-Tools\Batch and Registry Files
start virtualhelpscreen.exe
:top
c:
cd \gecko
timeout 12 /nobreak
gecko.exe
cls
goto :top
SCHTASKS /create /S $strComputer /xml "filesavedtomainpc" /tn "David\Start Gecko"
one issue left is it not forcing full screen like it does when you run the batch file but that might be down to the program, for now the question I asked is answered.
I'm writing an updater for my application and want to change my "Windows Task Scheduler" task configured by:
schtasks /create /sc once /tn my_task /tr MyApp.exe /rl highest /st 00:00
The updater is running "with highest privileges" and I mainly want to change the path of MyApp.exe.
I've tried:
schtasks /Change /tn my_task /tr MyUpdatedApp.exe (But it asks: Please enter the run as password for... even though the script already runs as admin. And so is not user friendly or even working in my scripted update.)
A powershell script using Get-/Set-ScheduledJob (But it says: A scheduled job definition with Name my_task could not be found. The help text even states Although jobs that are created by using the Register-ScheduledJob cmdlet appear in Task Scheduler, Get-ScheduledJob gets only scheduled jobs. It does not get scheduled tasks created in Task Scheduler.)
How can I updated my scheduled task from my updater/script without user interaction?
I've resorted to exporting and recreating the task using an XML file with the following command:
schtasks /create /f /tn my_task /xml C:\somewhere\my_task.xml
I create the my_task.xml file by exporting it by hand in the GUI and storing it as part of my application.
I want to write a Windows script (running in Windows 7) that runs every time when a new files has been created in a specified folder. It then checks weather the newly created file matches a certain naming convention and if so it moves it to a different folder.
How can I do the above?
If it doesn't have to be immediately after the files are created, then maybe simple task, checking the folder with interval and using robocopy to move the files will suffice? This can be accomplished with Task Scheduler:
schtasks /create /sc minute /mo 3 /tn FileCopy /tr ROBOCOPY C:\source_folder c:\destination_folder some_file_name*.* /MOV
/sc - Specifies the schedule frequency
/mo - Refines the schedule type to allow finer control over schedule recurrence. In this case it just specifies how many minutes until the task is run again
/tn - Name for the task that will be visible in task scheduler
/tr - Task to be executed /rl
You can also append /rl HIGHEST if you need more privileges to complete the task, and /ru SYSTEM to execute as SYSTEM user (you'll need admin privilege for that), so there won't be any console windows popping out every time tasks executes.
This command should create a task that every minute runs the calculator windows application.
schtasks /Create /tn "mytask" /sc MINUTE /mo 1 /ru "myuser" /rp "mypassword" /tr "C:\Windows\System32\calc.exe"
It runs OK, the tasks gets added. The task looks right. The tasks shows as started in the schedular but the calculator does not get fired up. The exe exists, I can run it separately.
Anyone know why I don't see the calculator?
How to Create, Modify and Delete Scheduled Tasks from the Command Line
Windows XP/Server 2003 introduced us to the SchTasks command line tool which usurped the At tool offered in Windows 2000. This tool offers the ability to control every aspect of your Scheduled Tasks through calls to this command.
While the wizard Windows uses to help you graphically create Scheduled Tasks is very good, the command line tool is ideal for situations such as:
Manipulate tasks in batch scripts.
Control and create tasks on networked machines without having to login to them.
Mass create/sync task across multiple machines.
Use in custom applications to communicate with the Task Scheduler instead of having to make API calls.
Eg:
Create ‘My Task’ to run C:RunMe.bat at 9 AM everyday:
SchTasks /Create /SC DAILY /TN “My Task” /TR “C:RunMe.bat” /ST 09:00
Modify ‘My Task’ to run at 2 PM:
SchTasks /Change /TN “My Task” /ST 14:00
Create ‘My Task’ to run C:RunMe.bat on the first of every month:
SchTasks /Create /SC MONTHLY /D 1 /TN “My Task” /TR “C:RunMe.bat” /ST 14:00
Create ‘My Task’ to run C:RunMe.bat every weekday at 2 PM:
SchTasks /Create /SC WEEKLY /D MON,TUE,WED,THU,FRI /TN “My Task” /TR “C:RunMe.bat” /ST 14:00
Delete the task named ‘My Task’:
SchTasks /Delete /TN “My Task”
Probably because the task isn't running interactively. Add the '/it' option:
/IT
A value that enables the task to run interactively only if the
/RU user is currently logged on at the time the task runs. The task
runs only if the user is logged on.
Without the /it option, tasks run in session 0, which doesn't allow interaction with the user. For more information, do a web search for "Session 0 isolation".
I want to know how to schedule a task using the command prompt.
Now I know you can probably find this on the internet, but I haven't found what I've been looking for.
The problem is that the operating system I have to do it on is in Swedish (Windows Server 2003 in Swedish).
It needs to run a program located at: 'C:\Documents and Setting\Administratör\Skrivbord\Midnight.exe'.
It should run around midnight, every day.
Does anybody know how to schedule this in cmd?
I do have administrator rights, so privileges shouldn't be a problem.
Just use schtasks windows utility in a .bat file or manually in CMD :
schtasks /create /ru Admin /rp paswd /tn "daily work" /tr "C:\Documents and Setting\Administratör\Skrivbord\Midnight.exe" /sc daily /st 23:55:00
Swedish should'nt be a special case :)
off course /ru is the username which we'll be used to run the task
You want the AT command to put an entry in the scheduler service TechNet on AT