why can't I use --eval and pass a file at same time?

Neto netorib94 at gmail.com
Tue Jun 24 14:59:59 UTC 2025


why can't use do something like this?

```d
import std.stdio : writeln, writefln;

void main()
{
	writeln("Hello");
}
```

and pass a file like:

>rdmd aa.d --eval="write(\"hello\");"

returns

```
object.Exception at rdmd.d(193): Cannot have both --eval and a 
program file ('eval.d').
----------------
??:? pure @safe void 
std.exception.bailOut!(Exception).bailOut(immutable(char)[], 
ulong, scope const(char)[]) [0x50e882]
??:? pure @safe bool 
std.exception.enforce!().enforce!(bool).enforce(bool, lazy 
const(char)[], immutable(char)[], ulong) [0x57954f]
??:? _Dmain [0x505753]
```


More information about the Digitalmars-d-learn mailing list