What file browser are you using? Nautilus?
Try:
ps -e | grep nautilus | sed 's/\(.[0-9]*\).*/\1/' | xargs kill
I just used firefox as an example...
Yes, my file browser is nautilus. I used your script but it once closes the desktop file browser and again reopen it automatically. I have tried the following script to get process id and then kill it as you have done but the result is same.
ps -e | grep nautilus | cut -c2-5 | xargs kill.
One thing which is also a matter of concern that when i use this script and file browser is closed, all the icons from the desktop disappear and no mouse click works over the desktop. What i want is that desktop icons remain appear on the screen and only desktop file browser gets closed.
Thanks...........