We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b26ac88 commit ba65ee0Copy full SHA for ba65ee0
1 file changed
Scripts/cd-windows.ps1
@@ -0,0 +1,26 @@
1
+<#
2
+.SYNOPSIS
3
+ Sets the working directory to the Windows directory
4
+.DESCRIPTION
5
+ This script changes the working directory to the Windows directory.
6
+.EXAMPLE
7
+ PS> ./cd-windows
8
+ 📂C:\Windows
9
+.LINK
10
+ https://github.com/fleschutz/PowerShell
11
+.NOTES
12
+ Author: Markus Fleschutz · License: CC0
13
+#>
14
+
15
+try {
16
+ $TargetDir = resolve-path "$env:WINDIR"
17
+ if (-not(test-path "$TargetDir" -pathType container)) {
18
+ throw "Windows directory at 📂$TargetDir doesn't exist"
19
+ }
20
+ set-location "$TargetDir"
21
+ "📂$TargetDir"
22
+ exit 0 # success
23
+} catch {
24
+ "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
25
+ exit 1
26
+}
0 commit comments