Well when you run + launch notepad as local AND ALSO are running the web server local (such as during development), then of course you see notepad since your running on the same computer as the web server.
If you run on a real web server, then your browser and you are on a different computer. Note pad is WILL and DOES launch just fine, but it's launching and displaying in the web server of which no one can see!!!!
So, on YOUR desktop and YOUR computer, you are running both IIS, and note pad. So, during development mode and phase - this looks to work ok.
But you cant redirect windows programs out to a browser. (windows programs have direct use of your graphics card).
But, if you launch note pad on the SAME computer running the web server? (which you are doing!!!). Then note pad will launch on the web server, and NOT your computer.
If you were able to walk over to the web server, you will see note pad launched and running on that server. But, you can't see nor use such desktop programs on your client side computer - which is only running a browser.
So, you can't for example launch a process on MY computer that hits YOUR web site!
EDIT: user understands that this is to run on the server side, and run on the web server console.
Well, had a chance to spool up a real server running IIS. And I can confirm that the code above will not work on the real server.
And the reason?
IIS on a server is running as a service, and on servers, they are not allowed to shell out. The permissions used to exist to do this, but from what I can tell, now they don't.
EVEN if you set the app pool to run as the server administrator account (very bad idea), I found that the code would not work.
So, to make this work?
well, you can do some serious chopping and changing on the actual web server - and you have to mess around with a lot of rights to do this.
I don't have a great answer, but a bit of googling, and we see that this in general is not allowed anymore.
So, it might depend on what version of server you have. Quite sure this hole was closed around 2012 version (10 years ago).
You can try some of the ideas here:
Foo.cmd won't output lines in process (on website)
(but, even above link is 10+ years ago - and now out of date).