Or go to Stata and choose Menu-->Edit-->Preferences-->Restore File Associations
The problem is caused by Stata expecting the command after the program
name, not a filename as is standard in Windows (the convention is that
if a program receives a single parameter, it should be treated as a
filename of the file to process, typically to "open", thus when a user
associates a program with a certain file type, Windows generates
"full_program_name" "%1" instead of Stata's required
"full_program_name" use "%1". Later verbs were added to "view",
"edit", "print", etc which are passed to the program via additional
command line parameters). Stata could probably be more tolerant, and
before issuing an error message check if a file with the specified
name exists (especially if the filename contains :\ as in
"C:\data.dta", because it is not valid for a command to have these
characters in the command name). Other strategies may be more
attractive.
Best regards, Sergiy Radyakin
On Fri, Jan 8, 2010 at 9:16 PM, Maksim L Pinkovskiy <[email protected]> wrote:
> Quoting Maksim L Pinkovskiy <[email protected]>:
>
> Dear Stata users,
>
> In August 2009, I posted the following question:
>
>> whenever I try to open a Stata dataset by clicking on it in Windows
>> Explorer, I
>> get output and an error message of the form:
>>
>> C:\data\mydataset
>> unrecognized command: C
>> r(199);
>
> I have since received an answer to this problem from another Stata user. I am
> posting the answer here so that other people could benefit from it if
> they have
> a similar problem as I did:
>
>
> You to modify the registry key in Windows, for doing that:
>
>
>
> 1. Open the Registry editor by running regedit.exe
>
> 2. Once you opened the editor open go to:
>
> Computer -> HKEY_CLASSES_ROOT -> Applications -> wmpstata.exe -> shell ->
> open -> command
>
> 3. On the right panel you should see "Default REG_SZ "C:\Program
> Files\Stata..
>
> 4. Mark it, press the right button of your mouse and select "modify"
>
> 5. Change the Value data: C:\Program Files\Stata9\wstata.exe" use
> "%1"
>
> 6. Press OK and it is done.
>
>
>
> What is important is to have the use option before "%1", that will allow you
> to open the files from explorer.
>
> I hope this will be useful.
>
> Yours Sincerely,
> Maxim Pinkovskiy.
>> *
>> * For searches and help try:
>> * http://www.stata.com/help.cgi?search
>> * http://www.stata.com/support/statalist/faq
>> * http://www.ats.ucla.edu/stat/stata/
>>
>
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/