Are you wanting to run this on the server or on the client? I'm guessing it's the latter, but hopefully you realize the incredible security risk in such an implementation. Following that, you'll then know why it's not necessarily easy to do.
In short, you're not going to be able to do it in a browser agnostic (or even platform agnostic) fashion with anything rendered into the page itself; that is, you'll need something like Java, Flash, ActiveX, Silverlight, etc. Even those carry security restrictions which will make it extremely difficult to run client-side CLI apps.
So, are you sure you need to do that? If you tell us what you're actually wanting to do we can offer some alternatives.