title: How to Run Long Powershell script from Windows Command Prompt (CMD)
body: <p>I tried to launch a long powershell script with the name "long name here.ps1" from command prompt. But I am also trying to ensure that it runs as an administrator command in powershell. I have all execution policies in powershell set accordingly I used the <a href="https://ss64.com/ps/set-executionpolicy.html" rel="nofollow noreferrer">ss64 set-executionpolicy command guide for powershell</a> to get powershell working. But I am trying to use the solution from <a href="https://stackoverflow.com/questions/8249705/how-to-run-an-application-as-run-as-administrator-from-the-command-prompt">another stackoverflow question</a> that talks about running commands as administrator. I am running a batch script that needs to execute a powershell script (.ps1) as admin, and I don't mind if the user is prompted by UAC or for the password. I am currently using the following command:</p>
  
  <blockquote>
    <p>powershell.exe -command "&amp;{ Start-Process powershell -ArgumentList '-noprofile -file "C:\long name here.ps1"' -verb RunAs}"</p>
  </blockquote>
  
  <p>I found this command at <a href="https://ss64.com/ps/powershell.html" rel="nofollow noreferrer">https://ss64.com/ps/powershell.html</a> at the bottom where there are details on how to run a powershell command as administrator. The problem with that code is that my powershell script 1. has arguments, and 2. has a long name. I have tried many different iterations of this command with no success, and the ones that DON'T work are listed below:</p>
  
  <blockquote>
    <p>powershell.exe -command "&amp;{ Start-Process powershell -ArgumentList '-noprofile -file C:\long` name` here.ps1' -verb RunAs}"</p>
    
    <p>powershell.exe -command "&amp;{ Start-Process powershell -ArgumentList '-noprofile -file:"C:\long name here.ps1' -verb RunAs}"</p>
  </blockquote>
  
  <p>Also, I am completely lost as to how to send arguments to the actual script.</p>