AT.exe help required

S

Shafiq ur Rehman

Hello,

I am seccessfully using following command to enter some task in task
scheduler


at.exe 14:00 /every:m,t,w,th,f,s,su c:\test\test.bat

but, it always names the new task as at1.job, at2.job and so on in
c:\winnt\tasks folder ...

i want to give the task my own name like MyTask.job in c:\winnt\tasks
folder what am i missing in the command,

Great Thanks in advance.


Kind Regards,

Shafiq Rao.
 
P

Pegasus \(MVP\)

You will have to use the Task Scheduler to do this.
You could also rename the jobs manually but if you do
then they will no longer be listed under the at command.
 
S

Shafiq ur Rehman

i got following solution and will like to share with you;

Private Sub Command3_Click()
'if RenamedUsingAT.job present then delete
If Dir$("C:\Winnt\Tasks\RenamedUsingAT.job", vbArchive) <> "" Then
MsgBox "C:\Winnt\Tasks\RenamedUsingAT.job exists, deleting the file
and creating a new one .."
Kill ("C:\Winnt\Tasks\RenamedUsingAT.job")
End If
'creating the job
Dim lProcessID
lProcessID = Shell("at.exe 14:00 /every:4 C:\MyExe.exe")
'getting the last created file
Dim s As String
Dim A As Date
Dim i As Integer
Dim Arr1() As String
Dim Arr2() As Date
Dim oldDate As Date

s = Dir$("C:\Winnt\Tasks\" & "*.*")
i = 0
Do While s <> ""
i = i + 1
A = FileDateTime("C:\Winnt\Tasks\" & s)
ReDim Preserve Arr1(i)
ReDim Preserve Arr2(i)
Arr1(i) = s
Arr2(i) = A
s = Dir$
Loop
Dim j As Integer
Dim lastFile As String
lastFile = Arr1(1)
For j = 2 To i
If Arr2(j - 1) < Arr2(j) Then
lastFile = Arr1(j)
Else
lastFile = Arr2(j)
End If
Next j

MsgBox "This is last Created File" & lastFile

'renaming the file
Name "c:\winnt\tasks\" & lastFile As
"c:\winnt\tasks\RenamedUsingAT.job"


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top