You said,
âYouâre telling what you want to do but youâre not telling why ⌠whatfor ⌠whatâs the bigger picture?
There might be a better way in PowerShell. You may keep in mind that PowerShell was not made for programmers or software developers. It was made for administrators.â
To be courteous to you, I tried to say less, but now I see I should have explained more. I am not a professional programmer or software developer, even though I am trying to learn to program Python for both system administration and database purposes. I am also trying to learn Powershell (âPSâ) for system administration purposes.
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.
I had assumed incorrectly that, to facilitate debugging a PS script, I should use write-host statements instead of the Python print statements.
Thank you for:
1. Disabusing me of that delusion, and a lot of other good education; and
2. Letting me know that the function object, fnLn, in PS is not a variable, and that is why my attempt to use the syntax (which would be appropriate for a variable) of â${fnLn}â does not send anything to the default output stream.
I am mildly Aspergers, and I need to understand something well to be comfortable using it. For my own educational and debugging purposes, I like to print to console (i.e., send to the default output stream) a text string such as the following:
[In Vbscript or VB or VBA or Python:] Line No. X: 'varname = ' + str(varname)
If you show me a better way of seeing what the values of vars are at various points in a PS script, for debugging purposes, I will be grateful and use whatever (better) method you show me.
But regardless of whatever new alternative approach you show me, my curiousity and Aspergers virtually require me to learn how to print to console (i.e., send to the default output stream) a text string (similar to what I use in VBScript, VB, VBA and Python), i.e.:
Line No. X: 'varname = ' + str(varname)
I want to know how to print that statement to console (i.e., send it to the default output stream) even if there is no reason for me to do that anymore because (hypothetically) you show me some debugging methodology that makes it a waste of my time and the computerâs time to print that statement to console.
I do not know what the proper PS notation would be, so please forgive me for using bracketed pseudocode to indicate the return value that I would like the âfnLnâ function to somehow send to the default output stream along with "
$varname = ${varname}"as follows:
[Line No. X:] "$varname = ${varname}"
Thank you again for your time and especially for your effort.
Marc