This is as expected (by me)
if I run the exact same query in SQL Developer 3.1.07.42 , it creates the file with:

< SELECT 1, 2, 3 FROM DUAL
1 2 3

(the < above is actually ">" but the CODE formatting software is screwing ">")
but I don't want the ECHOed command to be spooled. For the life of me, I cannot find a way to disable the ECHO from spooling in sql developer.
Tried the same in 3.0.4 and 2.1.1 with the same (bad) result (plus some warning on some of the unsupported SET commands).

Am I missing something obvious? Cause like this, the spool command cannot be used in sql developer to generate a CSV file for example, because of the echoed command. And windows doesn't come with SED by default so that is out. (plus that my original script is integrated into a much larger and complex set of scripts and the main script using them is executed from SQL Developer as a company policy (so that everybody uses the same tool and the code runs the same for everybody))

are there any other commands/settings that have such different behavior when run from "anonymous" worksheet (not saved, no file) compared to be run from a saved script file? A document/webpage or something? Would be interesting to know as I always do my test in "anonymous" worksheet and there were quite some occasions when things didn't work as expected based on sqlplus documentation and I had to find workarounds, which I did, until this particular issue.

Hi Gary, you seem to have some extensive knowledge. I'd like to follow-up on this thread and try to understand why SQL Developer won't hide the code even though I'm already running the code as a Worksheet (I assume you mean Run Script F5 button in SQL Developer).

I generally develop in SQL Developer that does a lot of dbms_output to echo data using a Spool command. When I'm in SQL Developer I can't get the code NOT to spool, it typically is echoed directly in the spool file at the top followed by the dbms_output data. If I save the sql file and run in in sqlplus it only outputs the data (good). If I use @C:\xyz_script.sql and hit F5 in SQL Developer it only outputs the data (per your previous answer) -- good.

So why can't I hit F5 in SQL Developer in the script file and have it only output the data? It just doesn't work no matter how many "SETs" you turn-off.

This is not my area so I could be wrong but, examining the Set Spool code, it looks like SQL Developer intentionally writes any top level commands to the spool file, even if ECHO is off -- probably in an attempt to match SQL*Plus behavior.

That would make any enhancement (SQL Developer Exchange feature request) or bug logged for this matter unlikely to be approved -- the product is just meeting one of its (loosely) professed goals: conform to SQL*Plus behavoir.