PowerShell: Start-Process cmdlet

DESCRIPTION Starts one or more processes on the local computer.  To specify the program that runs in the process, enter an executable file or script file, or a file that can be opened by using a program on the computer. If you specify a non-executable file, Start-Process starts the program that is associated with the file, much like the Invoke-Item cmdlet.      You can use the parameters of Start-Process to specify options, such as loading a user profile, starting the process in a new window, or using alternate credentials. SYNTAX Start-Process [-FilePath] <string> [[-ArgumentList] <string[]>] [-PassThru] [-Verb <string>] [-Wait] [-WindowStyle […]

Read more

Accessing User MyDocuments Folder Path via Powershell

Sample Code: PS C:> $MyDocs = [System.Environment]::GetFolderPath("MyDocuments") PS C:> Write-host $MyDocs C:UsersTestUser1Documents PS C:>   Listing all the SpecialFolders available via Environment Variables. Code: cls ### Start of Script ### Get the list of special folders $folders = [system.Enum]::GetValues([System.Environment+SpecialFolder]) # Display these folders "Folder Name            Path" "———–            ———————————————–" foreach ($folder in $folders) {     "{0,-22} {1,-15}"  -f $folder,[System.Environment]::GetFolderPath($folder)     } #End of Script   Output: Folder Name            Path ———–            ———————————————– Desktop                C:UsersTestuser1Desktop Programs               C:UsersTestuser1AppDataRoamingMicrosoftWindowsStart MenuPrograms Personal               C:UsersTestuser1Documents Personal               C:UsersTestuser1Documents Favorites              C:UsersTestuser1Favorites Startup                C:UsersTestuser1AppDataRoamingMicrosoftWindowsStart MenuProgramsStartup Recent                 C:UsersTestuser1AppDataRoamingMicrosoftWindowsRecent SendTo                 C:UsersTestuser1AppDataRoamingMicrosoftWindowsSendTo StartMenu              C:UsersTestuser1AppDataRoamingMicrosoftWindowsStart Menu MyMusic                C:UsersTestuser1Music DesktopDirectory       C:UsersTestuser1Desktop MyComputer                            Templates              C:UsersTestuser1AppDataRoamingMicrosoftWindowsTemplates ApplicationData        C:UsersTestuser1AppDataRoaming […]

Read more