Make sure there are no spaces in the filepath. Also, mIRC cannot /write to a file in a directory that doesn't exist. If the directory does exist but the file doesn't, /write will work and create the file, but if the directory doesn't exist either you get that error. If your directorypath contains spaces, mIRC will pick that up as a non existant directory...
/write c:\program files\text.txt stuff
In this case, mIRC will attempt to write the phrase files\text.txt stuff to the file called c:\program. While in this case there won't be a problem, similar things happen when spaces appear in the directory path.