For instance, if you were to run a Python script you would type python filename.py or if you wanted to run a C program make filename then ./ filename>
All the answers above are great, I see one thing missing and could be considered for running javascripts(*.js) files, the unrelated brother of javascript the Java.
JDK comes up with two nice tools, could be utilized for executing javascripts.
Here are command goes like. Make sure to navigate to JDK\bin.
jjs example.js
Its comes up with another commmand tool that goes like this-
jrunscript example.js
I hope this may be helpful to others.