Not stable? It returns the directory the executing script is in - that's all. It doesn't change unless you move the script to a new directory and then reload it.
As for $mircdir not supporting paths with spaces, you can see that it clearly does return paths with spaces by installing mIRC to a directory with spaces in it and then typing //echo -a $mircdir
The problem you're getting is when you try to pass a file/directory to certain commands without enclosing them in double quotes.
If a command has just one parameter (a file), or a command has only one file paramater and that parameter is last, then it's perfectly fine to pass a path without spaces. For example:
These are all fine:
/run c:\documents and settings
/splay c:\documents and settings\3.wav
/splay -p c:\documents and settings\x.mp3
But this is not:
/filter -ff c:\documents and settings\x.txt c:\documents and settings\y.txt
The reason for this is that mIRC has no idea where the first file ends. This is why you have to enclose it in quotes:
/filter -ff "c:\documents and settings\x.txt" "c:\documents and settings\y.txt"
You can do this by doing:
$+(",<file>,")
" $+ <file> $+ "
or $qt(<file>) (only added recently)
Identifiers don't suffer from the same problem because all parameters are separated by commas, so mIRC has no trouble working out filenames.
If this seems unclear, feel free to ask and I can try to clarify some points.