Net was filled with the value I put in my script. I did a quick test and it worked exactly as expected. Net, it was worth the test.Īs explained in this blog post, we can call the SetShouldExit method with a numeric value and that should be available from the outside world. I found an 10-years-old blog post with a very promising approach. But at the same time, it would have been too easy. I modified my PowerShell script to return a value using the Exit statement but was surprised to not be able to find it from my Process object in. I was aware of this statement to terminate the execution of a script and saw in the documentation that it was possible to pass and exitcode arguments (which is an integer) to return. The solution was created using Visual Studio 2019 but can be used in most older versions as well. This month’s downloadable demo solution contains both VB and C# projects. Of course PowerShell has the Exit statement but the code is not easily read by a. But this time, I want to be able to run a script that is persisted on disk and, even more important, to be able to get the exit code of my script into my. I still use something like this in my apps. This is something I already wrote about back in June 2018. Last week, I was launching a PowerShell script from a.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |