Link to home
Start Free TrialLog in
Avatar of StarDusterII
StarDusterII

asked on

task created with schtasks is using the wrong current directory

I'm creating a scheduled task within a .vbs that creates the task using:
schtasks /create /tn Eterna /tr "d:\data\eterna.vbs /sc WEEKLY /d MON,TUE,WED,THU,FRI /st 08:00:00

Open in new window


But when I run the task, it thinks the current directory is c:\windows\system32.  I have an .ini file in the same directory as .vbs (d:\data) that it can't find.  How to I get the task scheduler to use the same directory as the target of the action?
Avatar of StarDusterII
StarDusterII

ASKER

I found by adding /V1 to the parameters, it works correctly... I'm able to run the task by clicking run in the task scheduler.  However, using this switch when it creates the task, prompts for the user's password.  I'd like to skip that if possible.
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Interesting... I used:
CurrentDirectory = fso.GetAbsolutePathName(".")

Open in new window

Similar idea, but I'll give yours a go.
Perfect!  Thanks a ton.