[PSS2014] Ability to run a script without saving

Post feature requests, product enhancement ideas, and other product-specific suggestions here. Do not post bug reports.
Forum rules
Do not post any licensing information in this forum.
This topic is 9 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
aaronta
Posts: 6
Last visit: Thu Apr 16, 2020 3:09 pm

[PSS2014] Ability to run a script without saving

Post by aaronta »

I've looked through the settings and can't seem to find the ability to do this.

It's probably one of the main things I miss after using PowerGUI, is the ability to run a PS script that you have just written, without having to save it.

Sometimes I write a script, as a once-use case, but don't need it ever again.


maybe prompt to save, but allow to run without?
User avatar
Alexander Riedel
Posts: 8489
Last visit: Thu Apr 18, 2024 1:15 pm
Answers: 20
Been upvoted: 37 times

Re: [PSS2014] Ability to run a script without saving

Post by Alexander Riedel »

A script, by definition, is a file. You have to dot source the name of the script for PowerShell to execute it.

In PowerShell there is a tremendous context difference between executing a script from a proper file and pasting that code into a shell and executing it.
Alexander Riedel
SAPIEN Technologies, Inc.
Bosparan
Posts: 290
Last visit: Fri Oct 08, 2021 11:59 am

Re: [PSS2014] Ability to run a script without saving

Post by Bosparan »

Hi Aaron,

try marking the whole (unsaved) file ("CTRL" + "A") and press the "run selected code" key-combination ("CTRL" + "F8").
This does not require you to save the file.

Cheers,
Bosparan
This topic is 9 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked