문제

I am trying to schedule a task with cmd prompt.The command that I am running is:

C:\Windows\system32\schtasks.exe /CREATE /SC ONLOGON /TN "mytask" /TR "C:\samp.txt" /RU "NT AUTHORITY\SYSTEM" /RP /F

The task is showing in task manager with username as SYSTEM ,and its status is Running with code 0x41301.But it(samp.txt) is not showing in desktop.

The same command if I am replacing the "NT AUTHORITY\SYSTEM" with currently logged on user then it(samp.txt) is showing on desktop.

How can I make the task to display on desktop with /RU "NT AUTHORITY\SYSTEM"

도움이 되었습니까?

해결책

Did you try to add /IT ?
This is the only option which may allow you to display something on the active session using scheduled tasks. However, I am not sure that Windows will allow to interact with the desktop of another user.

Edit : You may use /RU BUILTIN\Users /IT, so any user will be able to run it interactively. What is you constraint on /RU system ?

If your goal is to display the samp.txt file content when a user logs on, another solution is to put the samp.txt in the startup folder of the "all users" start menu : C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup

다른 팁

could you try with psexec ? your command will be something like :

PSEXEC -i -s -d -w c:\ notepad.exe samp.txt
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top