Pardha
Pardha

Reputation: 103

How to execute powershell sctipt from browser typescript page?

I have written below code to execute powershell script from typescipt page. I can read the script output at run time using node.js But when I use the same code in react framework app (client side typescript) page, I'm getting error in browser console.

spawn is not a function

var spawn = require("child_process").spawn;
spawn("powershell.exe",[".\download-packages-license.ps1"]);

How to execute powershellscript at run time from the client side typescript react app?

Upvotes: 0

Views: 668

Answers (1)

Ayzrian
Ayzrian

Reputation: 2465

You can not execute PowerShell from a browser. The thing you are trying to do is Node.js code, but the browser is not the same thing as Node.js and therefore it does not have these functions and capabilities.

Browser code doesn't even have an access to the file system.

Upvotes: 1

Related Questions