run a program from a windows service
I have a program which i want to invoke from windows service.
xsftp.StartInfo 开发者_如何转开发= New ProcessStartInfo("c:\stage\psftp.exe", "testuser@X.X.X.X -b c:\stage\script.bat -pw XXX")
xsftp.Start()
The same code works fine if i write in a console application, but from windows service it wont run, i see the psftp is being started in the task manager but it wont do anything..
any ideas ? Thanks! Srin
Not sure if you still need this.. but you need to set the UseShellExecute to false:
p.StartInfo.UseShellExecute = False
I was having the same problem and couldn't find an answer anyway, but I looked into my old code and found the answer :)
Good luck
How do you determine it doesn't do anything? If you're looking for GUI, it might be running under a different user, without access to your desktop.
精彩评论