New
#31
Re-reading, I found this code buried as a one-liner:
The "trick" to psting multiline code here is to switch the edtor to "Code:method void OnButtonClick2(Object sender, EventArgs args ) begin BatFile1 = FilePath+"PosnPushAlert"+".bat"; FileDelete(BatFile1); Bat1Text = "Powershell.exe -executionpolicy remotesigned -File C:\Users\%UserName%\Desktop\PushOverPS.ps1 "; Bat1Text += doublequote+DTS()+" This is a test. "+doublequote; FileWrite(BatFile1,Bat1Text); if Elsystem.io.File.Exists(BatFile1) then environment.start(BatFileShtCut); Textbox1.Text = "OK"; end;Source mode
" with the A/A button:
Easier to read & harder to miss!
and, IMHO, should have been in the original post. as well as the resulting bat file, and the .ps1. It's like Russian nesting dolls with missing pieces otherwise. I get lost when people "describe" code but fail to show it!
There were already three pages of replies & I was scanning. But even on reading your earlier reply more carefully, You only state the first half of what I said --- The UI expands variables upon shortcut creation, but nothing about how to create a shortcut with an expandableTarget
path. Perhaps that is clear in the link you posted, but who knows --- you didn't specify the nature of the "workaroud".
The only code you posted was a.vbs
wrapper to run a PowerShell script, not a clear example of creating a shortcut with an expandableTarget
path. So I don't think my post is redundant; I think some will find it useful.
"You could work around this problem as described here:.."
does not, to my mind, tell me:
- whether or not a shortcut target can contain evironmental variables that are evaluated at exxecution
- If so,how to create them
which is what I mean by "...nature of the workaroud"
and I see, once I go through the extra step of opening the link, that the information is current, not out-dated, is PowerShell, etc...all good. But why not post the trhree lines of relavent code in your reply.
So many are wedded to batch & link to old examples (you can't blame me for being wary of the win7 part of tht link!) that I often assume the worst
I've had so much fun learning PowerShell I feel compelled to advocate for it & offer alternative code whenever possible, especially if it's not apparent ( to my nearly legally blind ass!) that equivalent code has already been offered. So sorry I missed tat. Bottom line, as any search for batch code will tell you, you can never have too many code examples out there!
![]()
Merely clicking on the link I posted does tell you exactly that.
Merely clicking on the link I posted does tell you exactly that as well.If so,how to create them
The nature of it is that it can very easily be found on Super User, i.e., by clicking on the link I posted, rather than not clicking.which is what I mean by "...nature of the workaroud"
Right.and I see, once I go through the extra step of opening the link, that the information is current, not out-dated, is PowerShell, etc...all good.
Why not click on the link I posted. Clicking on it would have been so much faster than waiting until you came up with a duplicate of the solution that I linked to. I mean, if people don't like to click on links, then that's their problem, not mine. Personally, I, like to click on links. In fact, clicking on links is how I found the solution, anyway in the first place. One example of things I usually don't like are called bottomless pits, but in this particular instance I am prepared to fully admit it's one of the most beautiful bottomless pits that I have seen.But why not post the trhree lines of relavent code in your reply.
No worries. I was only joking of course.So many are wedded to batch & link to old examples (you can't blame me for being wary of the win7 part of tht link!) that I often assume the worst
I've had so much fun learning PowerShell I feel compelled to advocate for it & offer alternative code whenever possible, especially if it's not apparent ( to my nearly legally blind ass!) that equivalent code has already been offered. So sorry I missed tat. Bottom line, as any search for batch code will tell you, you can never have too many code examples out there!
![]()
![]()
I had a similar problem to this when using DFS-Namespace paths.