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.
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.
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.
The topic ‘Running .ps1 to PowerShell’ is closed to new replies.