# Show script line number in write-host statements along with literal strings and vars

**URL:** <https://forums.powershell.org/t/show-script-line-number-in-write-host-statements-along-with-literal-strings-and-vars/23084>\
**Category:** PowerShell Help\
**Created:** [November 3, 2023, 6:51am UTC](https://forums.powershell.org/t/show-script-line-number-in-write-host-statements-along-with-literal-strings-and-vars/23084 "2023-11-03T06:51:34Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![Gloops](https://avatars.discourse-cdn.com/v4/letter/g/8491ac/32.png) [@Gloops](https://forums.powershell.org/u/Gloops)\
**Post date:** [November 6, 2023, 9:20am UTC](https://forums.powershell.org/t/show-script-line-number-in-write-host-statements-along-with-literal-strings-and-vars/23084/9 "2023-11-06T09:20:10Z")

</div>

> [@marceepoo](#):
>
> When I was trying to debug a VBScript or VBA program, I would show the values of various vars using the messagebox method at critical points. In Python, I do something similar to facilitate debugging by making a practice of printing the values of vars to the console (e.g., “print('varname = ’ + str(varname))”), at every step where I modify the var. When I have finished debugging the Python script, I remove or comment out those print statements.

In PowerShell, when you write the name of a variable alone on a line of script, that displays its value on the console (at execution, naturally).  
If you want a line number in front of it, you can write it in the code, but it will not be updated when you insert or suppress lines.  
If you want to execute step by step, you have to use PowerShell ISE, that you will find in the start menu of Windows.  
Then, you can put breakpoints, and starting from a breakpoint execute step by step with the F11 key.  
During the stop at a breakpoint, you can get the value of a variable by positioning the mouse cursor on it.

---

_[View the full topic](https://forums.powershell.org/t/show-script-line-number-in-write-host-statements-along-with-literal-strings-and-vars/23084)._
