English 中文(简体)
如何在 Windows XP 上的批量文件中启动 Outlook?
原标题:How to start Outlook from within a batch file on Windows XP
Good day, I m trying to find a way to open Outlook automatically from within a batch file called via the Task Scheduler, but can t seem to land on a method that works. The overall reason I m doing this is that I m trying to automate a backup of the Outlook pst file. Outlook needs to be closed to copy the pst file. I can kill Outlook okay and copy the pst file. I d just like to be able to restart Outlook automatically when I m done. I ve tried a number of variations using the runas command such as: runas /savecred /user:computernamemark "C:Program FilesMicrosoft OfficeOfficeOUTLOOK.EXE" and runas /noprofile /savecred /user:peter-fe7f4dbcdmark "C:Program FilesMicrosoft OfficeOfficeOUTLOOK.EXE" These work fine from the command line, but when started via Task Scheduler, Outlook never starts. Windows Task Manager shows the process runas.exe as having been launched. It appears to be waiting for something like my user credentials, but there s no way to tell. I ve also tried using the start command to no avail as yet. Using the following syntax results in Outlook starting as a new process shown within Task Manager, but Outlook never appears on my desktop. start /d "C:Program FilesMicrosoft OfficeOffice" OUTLOOK.EXE Note too that this works fine if run from a command prompt. Also note that my Mark account is a member of both the Administrators and Users groups. I d appreciate any ideas you guys might have to get this to work. Thanks a lot. Mark
问题回答
Thanks a million David! I actually didn t realize I could create a task using the Task Scheduler program. Doing as you suggested and providing my Windows password for the task works perfectly. I was adding the task via the command line: at 3:00 /every:s d:atfilesStart_Outlook.bat So as expected in Task Scheduler this was shown as been created by the System user. I m still curious if anyone has a method that would work to start Outlook via a batch file that is run by the System user. Many thanks.




相关问题
Why running a service as Local System is bad on windows?

I am trying to find out the difference between difference service account types. I tumbled upon this question. The answer was because it has powerful access to local resources, and Network Service ...

Programmatically detect Windows cluster configuration?

Does anyone know how to programatically detect that a Windows server is part of a cluster? Further, is it possible to detect that the server is the active or passive node? [Edit] And detect it from ...

get file icon for Outlook appointment (.msg)

I ve read Get File Icon used by Shell and the other similar posts - and already use SHFileInfo to get the associated icon for any given extension, and that works great. However, Outlook uses ".msg" ...

Identifying idle state on a windows machine

I know about the GetLastInputInfo method but that would only give me the duration since last user input - keyboard or mouse. If a user input was last received 10 minutes ago, that wouldn t mean the ...

Terminating a thread gracefully not using TerminateThread()

My application creates a thread and that runs in the background all the time. I can only terminate the thread manually, not from within the thread callback function. At the moment I am using ...

热门标签