ITask::SetWorkingDirectory method (mstask.h)
[[This API may be altered or unavailable in subsequent versions of the operating system or product. Please use the Task Scheduler 2.0 Interfaces instead.] ]
This method sets the working directory for the task.
Syntax
HRESULT SetWorkingDirectory(
[in] LPCWSTR pwszWorkingDirectory
);
Parameters
[in] pwszWorkingDirectory
A null-terminated string that contains a directory path to the working directory for the task.
The application starts with this directory as the current working directory. To clear the directory, set pwszWorkingDirectory to L"". If the working directory is set to L"", when the application is run, the current directory will be the directory in which the task scheduler service executable, Mstask.exe, resides.
Return value
The SetWorkingDirectory method returns one of the following values.
Return code | Description |
---|---|
|
The operation was successful. |
|
The arguments are not valid. |
|
Not enough memory is available. |
Remarks
After setting the working directory of a task, be sure to call IPersistFile::Save to save the modified task object to disk.
Examples
For an example of how to set the working directory of a task, see C/C++ Code Example: Setting Working Directory.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | mstask.h |
Library | Mstask.lib |
DLL | Mstask.dll |
Redistributable | Internet Explorer 4.0 or later on Windows NT 4.0 and Windows 95 |