Skip to content

Commit cbe1087

Browse files
authored
Merge pull request #10 from alx9r/update-docs-for-shortcut
update docs for Shortcut
2 parents fd26f4e + 3a7211a commit cbe1087

File tree

2 files changed

+50
-9
lines changed

2 files changed

+50
-9
lines changed

Docs/readme.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,48 @@ Script 0.1.0 WindowsShell {Add-ShellLibrary, ...
3434

3535
You should see some details about the WindowsShell module output by the `Get-Module` command as shown above.
3636

37+
## Configuring Windows Shortcuts
38+
The WindowsShell module implements two interfaces for configuring shell libraries:
39+
40+
* the PowerShell command `Invoke-ProcessShortcut`
41+
* the DSC Resource `Shortcut`
42+
43+
## Commands
44+
45+
The following command creates a Windows shortcut to `powershell.exe` on the desktop and assigns hotkeys to it.
46+
47+
```PowerShell
48+
$splat = @{
49+
Path = "$env:USERPROFILE\Desktop\powershell.lnk"
50+
TargetPath = (Get-Command powershell.exe).Path
51+
Hotkey = 'Ctrl+Alt+Shift+P'
52+
}
53+
Invoke-ProcessShortcut Set Present @splat
54+
55+
```
56+
57+
The results can be observed using Windows Explorer.
58+
59+
<img src="https://cloud.githubusercontent.com/assets/11237922/25685638/cb643b9a-301d-11e7-8dfb-374d6060c17e.png" alt="windows explorer and properties dialog box showing desktop shortcut" width="600">
60+
61+
### DSC Resource
62+
63+
Invoking the following ZeroDSC commands creates the same desktop shortcut as shown in the "Command" section above, except using the `Shortcut` DSC resource:
64+
65+
```PowerShell
66+
$instructions = ConfigInstructions PSHotkey {
67+
Get-DscResource Shortcut WindowsShell | Import-DscResource
68+
69+
Shortcut PSHotkey @{
70+
Path = "$env:USERPROFILE\Desktop\powershell.lnk"
71+
TargetPath = (Get-Command powershell.exe).Path
72+
Hotkey = 'Ctrl+Alt+Shift+P'
73+
}
74+
}
75+
76+
$instructions | Invoke-ConfigStep
77+
```
78+
3779
## Configuring Windows Shell Libraries
3880

3981
The WindowsShell modules implements two interfaces for configuring shell libraries:

readme.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@
22

33
# WindowsShell
44

5-
WindowsShell is a PowerShell module for configuring Windows Shell Libraries.
5+
WindowsShell is a PowerShell module for configuring Windows Shell Libraries and Shortcuts.
66

77
# Use
88

9-
Configure Windows Shell Libraries like this
9+
* Configure Windows Shortcuts
10+
* Configure Windows Shell Libraries
11+
* Perform the configuration using straightforward PowerShell commands
12+
* Perform the configuration using PowerShell DSC
1013

11-
<img src="https://cloud.githubusercontent.com/assets/11237922/21626090/0069d2a4-d1c4-11e6-806c-47273fe07b92.png" alt="windows explorer showing shell library" width="400">
12-
13-
using straightforward PowerShell commands like this
14+
### What's a Windows Shell Library?
15+
Windows Shell Libraries are built-in to all versions of Windows beginning with Windows Vista. They provide a standardized way of surfacing folders in the file system in Windows Explorer and most application's file dialog boxes.
1416

15-
```PowerShell
16-
PS C:\> $iconPath = "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe"
17-
PS C:\> Invoke-ProcessShellLibrary Set Present 'PSModulePath' -IconFilePath $iconPath
18-
```
17+
<img src="https://cloud.githubusercontent.com/assets/11237922/21626090/0069d2a4-d1c4-11e6-806c-47273fe07b92.png" alt="windows explorer showing shell library" width="400">
1918

2019
# Getting Started
2120

0 commit comments

Comments
 (0)