Author Posts

September 2, 2014 at 7:56 am

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.

Thanks.

September 2, 2014 at 8:06 am

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.

September 2, 2014 at 8:41 am

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.