Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

327
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda