For this column we wanted the name of the folder where the script resides. Run strPath Now, back to our original script. After storing the full path to the script in the variable strPath we next create an instance of the Scripting. That brings us to these two lines of code:.
Although there are several different ways we could do this, we felt this approach was the simplest. And that also happens to be the very folder we want to open.
The rest is easy. Comments are closed. Scripting Forums. PowerShell Forums. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. Ask Question. Asked 12 years, 1 month ago. Active 4 years, 7 months ago. Viewed 41k times. Improve this question. TallGuy TallGuy 1 1 gold badge 2 2 silver badges 8 8 bronze badges.
Add a comment. Active Oldest Votes. Improve this answer. Phil Ross Phil Ross 6, 2 2 gold badges 23 23 silver badges 19 19 bronze badges. That's what I'm doing at the moment, every time I log on. I want to do it in a batch file so it can be done automatically. Viewed k times. Improve this question. Flimzy Add a comment. Active Oldest Votes. Improve this answer. Mat Mat k 39 39 gold badges silver badges bronze badges. If you add a setlocal to your batch file, the path is only visible in the file — jeb.
Is that in place of "SET"? Life saver. I needed to add an EV on a server that couldn't be restarted and this allows me to do what I need without having to schedule a restart! Show 3 more comments. The difference is the quotes! UPD also see the comment by venimus.
Wrapping in quotes like this will not include them but will properly set the variable. Same works for any other env variable. Thank you venimus for your comment. In my company where we have all the same laptops with same system there is not a universal script for PATH setting and we are maintaining 2 or 3 of them, so whatever works for you : — dumbak.
0コメント