Running .ps1 to PowerShell

This topic contains 2 replies, has 3 voices, and was last updated by  Eric Bronnert 3 years, 8 months ago.

  • Author
  • #18443

    Arlyce Abuan

    I am fairly new to PowerShell & one of the virtual learning I've seen was a series of .ps1 file was created and then dragged into the PowerShell window and the script ran.
    I couldn't asked a question on that tutorial since it's a recorded one.

    Anybody know's how to do this?
    I know how to create the .ps1 and is able to run my script by right clicking and selecting to Run in PowerShell.

    But I need to know how to do the drag and drop and script gets executed.


  • #18444

    Dave Wyatt

    I'd never tried this before. When I drag a PS1 file onto my open PowerShell console, it fills in the file name on the command line. All that was needed to run the script was to press Enter. I assume that if this is what was done in the video you watched, they also pressed Enter, but you didn't see that part in the recording.

  • #18445

    Eric Bronnert

    I just tried this as well and I can confirm that dragging a ps1 file onto the shell itself will enter in the file's directory via command line. I also had to press enter to get it to execute, and then it worked.

You must be logged in to reply to this topic.