Rust program: If a GUI program has a space in its program exe file path, it'll failed started from windows service.

本明 1 Reputation point
2022-12-01T05:57:44.587+00:00

when I use CreateProcessAsUserW to start a GUI program from windows service, if the the GUI program file path has space in it, it will started and then quit immediately. if the program file path has no space, it will started OK. if start the GUI program not from windows service, it'll ok in spite of a space in file path or not.

additional: I have try this before, and I try it again seriously after your suggestion, and the problem still exist.
I think the problem is case by a space in file path and also is not case by a space in file path, it's contradiction. let me talk about:

when there is no space in path, the program started by service ok. according to this, I guess the problem case by a space in file path.
when there is a space in path, the program can started by service, I can see the GUI window, but exit immediately. according to this, I can guess the program exe path with a space is ok, CreateProcessAsUserW function can find the program exe through path with a space.
so, it's contradiction and confuse me, why GUI program exit immediately, path? security? or others? I don't know and I can't find any logs.

If a GUI program has a space in its program exe file path, it'll failed started from windows service

Service Manager
Service Manager
A family of System Center products for managing incidents and problems.
209 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. 本明 1 Reputation point
    2022-12-20T08:47:57.363+00:00

    This problem has sovled. When you use system user or start the program by user with administrator role, regardless of a space in the program path or not, it can start program normal, but i don't know the reason, tell me why if someone know the base reason.

    0 comments No comments