Hi all!
I’m currently working through the Introduction to Windows Command Line module, more specifically the Working with Scheduled Tasks section under CMD.
I’ve got a query about the schtasks
command when I was playing around. I currently have this command:
schtasks /create /sc minute /tn "My Task" /tr "echo test123 > C:\Users\htb-student\Documents\myfile.txt"
However this never is executed, as the file “testing.txt” is never created - yet when I manually run the command, the file is created as expected. The task is not run even if I run schtasks /run /tn "My Task"
. I can verify the task has been created however by running schtasks /query /v /tn "My Task"
.
I’ve tried including the /mo 1
option but it still doesn’t work.
I’ve also tried making it run a .bat
file to see if it’ll work, but once again it doesn’t create the file. If I run the .bat file manually (without using schtasks) it creates the file as expected.
This doesn’t work either on the pwnbox through Academy or on my local machine (even with an elevated command prompt).
Does anyone know where I am going wrong? I’ve never played with schtasks before so it’s probably something really silly I’m overlooking.
Many thanks in advance.