You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Windows, you can also use [ISE][use-ise-debugger] to debug PowerShell scripts.
64
+
On Windows, you can also use [PowerShell Integrated Scripting Environment (ISE)][use-ise-editor] to edit or debug PowerShell scripts.
65
+
However it is not supported if you are using PowerShell installed from the [PowerShell package][get-powershell] or directly [built][building-the-repository] from GitHub.
Copy file name to clipboardExpand all lines: docs/learning-powershell/using-ise.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
Using PowerShell Integrated Scripting Environment (ISE)
2
2
====
3
3
The PowerShell ISE only works on Windows. If you are not using Windows, please see [Using Visual Studio Code](./using-vscode.md).
4
+
Please note the ISE is not supported if you are using PowerShell installed from the [PowerShell package][get-powershell] or directly [built][building-the-repository] from GitHub.
4
5
5
6
Editing with ISE
6
7
---
@@ -72,3 +73,5 @@ PS C:\test>
72
73
See [How to Debug in ISE][debug] for more information.
Copy file name to clipboardExpand all lines: docs/learning-powershell/using-vscode.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
Using Visual Studio Code (VS Code)
2
2
====
3
3
4
-
If you are working on Linux and OS X, you cannot use ISE because it is not supported on these platforms.
5
-
In this case, you can choose your favorite editor to write PowerShell scripts.
4
+
If you are working on Linux and OS X, you cannot use ISE because it is not supported on these platforms.
5
+
In this case, you can choose your favorite editor to write PowerShell scripts.
6
6
Here we choose VS Code as a PowerShell editor as an example.
7
7
8
8
You can use VS Code on Windows with PowerShell V5 by using Windows 10 or by installing [Windows Management Framework 5.0 RTM](https://www.microsoft.com/en-us/download/details.aspx?id=50395) for down-level Windows OSs (e.g. Windows 8.1, etc.).
9
9
10
-
Before starting it, please make sure PowerShell exists on your system.
11
-
By following the [Installing PowerShell](./learning-powershell.md#installing-powershell) instructions you can install PowerShell and launch a PowerShell session.
10
+
Before starting it, please make sure PowerShell exists on your system.
11
+
By following the [Installing PowerShell](./README.md#installing-powershell) instructions you can install PowerShell and launch a PowerShell session.
12
12
13
13
Editing with VS Code
14
14
----
@@ -38,31 +38,31 @@ Editing with VS Code
38
38
39
39
- After the install, you will see the **Install** button turns to **Enable**.
40
40
- Click on **Enable** and **OK**
41
-
- Now you are ready for editing.
42
-
For example, to create a new file, click **File->New**.
43
-
To save it, click **File->Save** and then provide a file name, let's say "helloworld.ps1".
44
-
To close the file, click on "x" next to the file name.
41
+
- Now you are ready for editing.
42
+
For example, to create a new file, click **File->New**.
43
+
To save it, click **File->Save** and then provide a file name, let's say "helloworld.ps1".
44
+
To close the file, click on "x" next to the file name.
45
45
To exit VS Code, **File->Exit**.
46
46
47
47
48
48
Debugging with VS Code
49
49
----
50
50
51
-
- Open a file folder (**File->Open Folder**) that contains the PowerShell modules or scripts you have written already and want to debug.
52
-
In this example, we saved the helloworld.ps1 under a directory called "demo".
51
+
- Open a file folder (**File->Open Folder**) that contains the PowerShell modules or scripts you have written already and want to debug.
52
+
In this example, we saved the helloworld.ps1 under a directory called "demo".
53
53
Thus we select the "demo" folder and open it in VS Code.
54
54
55
55
- Creating the Debug Configuration (launch.json)
56
56
57
-
Because some information regarding your scripts is needed for debugger to start executing your script, we need to set up the debug config first.
58
-
This is one-time process to debug PowerShell scripts under your current folder.
57
+
Because some information regarding your scripts is needed for debugger to start executing your script, we need to set up the debug config first.
58
+
This is one-time process to debug PowerShell scripts under your current folder.
59
59
In our case, the "demo" folder.
60
60
61
61
* Click on the **Debug** icon (or **Ctrl+Shift+D**)
62
-
* Click on the **Settings** icon that looks like a gear.
63
-
VS Code will prompt you to **Select Environment**.
64
-
Choose **PowerShell**.
65
-
Then VS code will auto create a debug configuration settings file in the same folder.
62
+
* Click on the **Settings** icon that looks like a gear.
63
+
VS Code will prompt you to **Select Environment**.
64
+
Choose **PowerShell**.
65
+
Then VS code will auto create a debug configuration settings file in the same folder.
66
66
It looks like the following:
67
67
```json
68
68
{
@@ -89,7 +89,7 @@ It looks like the following:
89
89
```
90
90
- Once the debug configuration is established, go to your helloworld.ps1 and set a breakpoint by pressing **F9** on a line you wish to debug.
91
91
- To disable the breakpoint, press **F9** again.
92
-
- Press **F5** to run the script.
92
+
- Press **F5** to run the script.
93
93
The execution should stop on the line you put the breakpoint on.
94
94
- Press **F5** to continue running the script.
95
95
@@ -109,4 +109,4 @@ There are a few blogs that may be helpful to get you started using PowerShell ex
109
109
PowerShell Extension for VS Code
110
110
----
111
111
112
-
PowerShell extension source code can be found [GitHub](https://github.com/PowerShell/vscode-powershell-ops)
112
+
PowerShell extension source code can be found [GitHub](https://github.com/PowerShell/vscode-powershell-ops).
0 commit comments