Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 14th July 2009, 13:12   #1
nsnb
Senior Member
 
Join Date: Jul 2008
Posts: 157
Question Please help understand nsExec::Exec mystery

A baffling problem: The following line runs PERFECTLY in an NSIS script:
PHP Code:
nsExec::Exec '"$varCOMSPEC" /C assoc .bat=batfile' 
But when adding redirection, it actually ruins the association:
PHP Code:
nsExec::Exec '"$varCOMSPEC" /C assoc .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.
nsnb is offline   Reply With Quote
Old 14th July 2009, 13:40   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
In what way does it ruin the association?

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 14th July 2009, 14:15   #3
nsnb
Senior Member
 
Join Date: Jul 2008
Posts: 157
Quote:
Originally posted by Afrow UK
In what way does it ruin the association?
It turns an OK context menu:

To this (incorrect) context menu:


I also compared the registry before and after and the only relevant difference that I was able to spot is:

OK:
Quote:
[HKEY_CLASSES_ROOT\.bat]
@="batfile"
BAD:
Quote:
[HKEY_CLASSES_ROOT\.bat]
@="batfile "
Apparently the redirection appends a space after "batfile". Hmmm...
nsnb is offline   Reply With Quote
Old 14th July 2009, 14:35   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
Try getting rid of the space before the >.

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 14th July 2009, 14:42   #5
nsnb
Senior Member
 
Join Date: Jul 2008
Posts: 157
Quote:
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:
Quote:
"%COMSPEC%" /C assoc .bat=batfile> nsExecTest.log
While the following doesn't work:
Quote:
"%COMSPEC%" /C assoc .bat=batfile > nsExecTest.log
Is this considered a bug in command.com?
nsnb is offline   Reply With Quote
Old 14th July 2009, 14:46   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
It's more likely just how assoc.exe parses its command line. Command Prompt will give it everything before the > including the space.

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump