Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

332
Vistas
Recientemente creé una GUI usando un archivo .hta. Quiero ejecutar un script de PowerShell que escribí. no puedo corregir este error

me sale este error: Mensaje de error que recibo

No puedo encontrar cuál es realmente el problema debido a mi conocimiento limitado, todo parece correcto

Aquí está el código que estoy usando:

 <html> <head> <title>Application Executer</title> <HTA:APPLICATION ID="oMyApp" APPLICATIONNAME="Application Executer" BORDER="yes" CAPTION="no" SHOWINTASKBAR="yes" SINGLEINSTANCE="yes" SYSMENU="yes" SCROLL="yes" WINDOWSTATE="normal"> <script type="text/javascript" language="javascript"> function RunFile() { WshShell = new ActiveXObject("WScript.Shell"); WshShell.Run("C:Users\User\OneDrive\Desktop\Apps\Clean_Teams.ps1", 1, false); } </script> </head> <body> <br> <br> <center> <input type="button" value="Clean Teams" onclick="RunFile();"/> <br> <br> <input type="button" value="Clean Chrome" onclick="RunFile();"/> <br> <br> <input type="button" value="Clean Edge" onclick="RunFile();"/> </center> </body> </html>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Como se menciona en los comentarios, debe ejecutar powershell.exe con los parámetros apropiados. A continuación se muestra un ejemplo de HTA para iniciar scripts de PowerShell que muestra una forma de configurar la línea de comando correcta. También tenga en cuenta que X-UA-Compatible está configurado en IE=9 . Sin ninguna declaración, la HTA pasará por defecto al modo IE=5 .

 <!DOCTYPE html> <html> <head> <title>Script Selector</title> <meta charset="UTF-8" http-equiv="X-UA-Compatible" content="IE=9"> <hta:application id=oHTA icon=Powershell.exe > <script> Visible=1; NoWait = false; w = 640; h = 480; oWSH = new ActiveXObject("WScript.shell"); window.resizeTo(w, h); window.moveTo((screen.availWidth - w)/2, (screen.availHeight - h)/2); function RunScript(ScriptName) { if (db.checked) { x = "-NoExit"} else {x = ""} CmdLine = 'Powershell.exe ' + x + ' -ExecutionPolicy Bypass -File "' + ScriptName + '"'; oWSH.Run(CmdLine,Visible,NoWait); } </script> <style> body {background-color:LemonChiffon; font-family:Segoe UI; font-size:11pt} br {font-size: 16pt} </style> </head> <body> <input id=db type=checkbox>Debug (check to keep PowerShell console open)<br> <input id=b1 type=button value="PowerShell Script 1.ps1" onclick=RunScript(b1.value)><br> <input id=b2 type=button value="PowerShell Script 2.ps1" onclick=RunScript(b2.value)><br> <input id=b3 type=button value="PowerShell Script 3.ps1" onclick=RunScript(b3.value)><br> </body> </html>
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda