nsnb
14th July 2009 14:12 UTC
Please help understand nsExec::Exec mystery
A baffling problem: The following line runs PERFECTLY in an NSIS script:
nsExec
::Exec'"$varCOMSPEC"/Cassoc.bat=batfile'
But when adding redirection, it actually ruins the association:
nsExec
::Exec'"$varCOMSPEC"/Cassoc.bat=batfile>nsExecTest.log'
Any idea
why?Please note that I am not asking about the 'assoc' internal Windows command (I also know about the alternative
File Association plugin). I am merely trying to understand why the behavioral change of
nsExec::Exec when adding
redirection to a log file.
Thanks. :)
Afrow UK
14th July 2009 14:40 UTC
In what way does it ruin the association?
Stu
nsnb
14th July 2009 15:15 UTC
Originally posted by Afrow UK
In what way does it ruin the association?
It turns an OK context menu:
http://img190.imageshack.us/img190/6439/assocok.th.pngTo this (incorrect) context menu:
http://img182.imageshack.us/img182/1913/assocbad.th.pngI also compared the registry before and after and the only relevant difference that I was able to spot is:
OK:
[HKEY_CLASSES_ROOT\.bat]
@="batfile"
BAD:
[HKEY_CLASSES_ROOT\.bat]
@="batfile "
Apparently the redirection appends a space after "batfile". Hmmm...
Afrow UK
14th July 2009 15:35 UTC
Try getting rid of the space before the >.
Stu
nsnb
14th July 2009 15:42 UTC
Originally posted by Afrow UK
Try getting rid of the space before the >.
Thank you! That helped.
It turns out that this problem exists in the command.com prompt (in Windows XP at least) without regard to NSIS.
The following works:
"%COMSPEC%" /C assoc .bat=batfile> nsExecTest.log
While the following doesn't work:
"%COMSPEC%" /C assoc .bat=batfile > nsExecTest.log
Is this considered a bug in command.com?
Afrow UK
14th July 2009 15:46 UTC
It's more likely just how assoc.exe parses its command line. Command Prompt will give it everything before the > including the space.
Stu