Hey, not sure if I am asking something that has been dealt with before. If I am then I apologise for wasting everyone's time, but I couldn't find quite what my problem is searching through past posts.

basically I am trying to write to an ini file in a script, and a command along the lines of

Code:
/writeini testfile.ini Section Variable Value


produces an entry along the lines of

Code:
[Section]
Variable=Value


as we would expect.
I, being a keen little so-and-so wanted to be a bit cleverer and so am using something like

Code:
/writeini $shortfn($scriptdir\testfile.ini) Section2 Variable2 Value2


so that it can be called from wherever the script ends up. Of course this isn't totally correct and I properly should use

Code:
/writeini $shortfn($scriptdirtestfile.ini) 


...etc but I just feel unhappy without that extra backslash.

All is well until I (don't ask me why, I don't know) tried to run the script without an existing ini file to write to at which point everything has gone to hell. When I do this, the line shown above generates a file C:\Program

containing

Code:
[Files\mIRC\\testfile.ini]
Section2=Variable2 Value2


This is a bit unhelpful, and yes I know that so long as my ini file exists then I can happily carry on accessing it as I am. But liking to design for other eventualities as I do this is a bit unsatisfactory.

So, can I make mirc generate an ini file where I want it if it doesn't already exist, and if so, how?