![]() We store the folder path in the variable strPrograms: Set objShell = CreateObject(“Wscript.Shell”) This time we create an instance of the WSH Shell object and call the SpecialFolders method, telling SpecialFolders we’d like the location of the Programs folder. Next we need to determine the locations of the Start menu Programs folder. If you want to create a shortcut to a different folder (for example, \\atl-fs-01\public\kenmyer), you just need to change this line of code accordingly. That gives us a path to a user folder like C:\Documents and Settings\kenmyer. Note that we’ve also created a variable named strPath and assigned it the value C:\Documents and Settings\ plus the user name (e.g., kenmyer). StrPath = “C:\Documents and Settings\” & strUser That’s what we do here: Set objNetwork = CreateObject(“Wscript.Network”) That’s easy: we just create an instance of the WSH Network object and retrieve the value of the UserName property. To begin with, we need to figure out the name of the logged-on user (which happens to map to the %username% environment variable). We’ll explain how to do each of these subtasks, then at the end put the pieces together to create a single script that solves your problem for you. As we are wont to do, we’re going to break this question down into subtasks. Hey, Scripting Guy! How can I create a folder on the Start menu? I want the folder to be named the same as the %username% environment variable.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |