Search the FORUM first! Lot many times this question was posted.
Anyway here is one answer from Ajeetha.
Code:
Use TCL in batch mode, you don't need to do it interactively, try the
following tcl file:
-- tcl file
database -open waves -shm -default
probe -shm -all -depth all top
run
exit
----
Use it with ncsim -input dump.tcl <other options>