getting pid from a process

Hi all,
i was able to redirect pid of process to a file in the following way
ps aux|awk '$11 == "/Applications/ProjectX/DServer" >> /Applications/ProjectX/DServer.pid

it works fine but if one folder name caontains space its not working like below
ps aux|awk '$11 == "/Applications/Project\ X/DServer" >> /Applications/ProjectX/DServer.pid

can any one guide me whats going wrong

for starters its not a good idea to parse your ps output.

Try using

ps -eo pid