We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ea63371 commit 8cf0a23Copy full SHA for 8cf0a23
Scripts/cd-logs.ps1
@@ -0,0 +1,29 @@
1
+<#
2
+.SYNOPSIS
3
+ Sets the working directory to the logs folder
4
+.DESCRIPTION
5
+ This PowerShell script changes the current working directory to the logs directory.
6
+.EXAMPLE
7
+ PS> ./cd-logs
8
+ 📂/var/logs
9
+.LINK
10
+ https://github.com/fleschutz/PowerShell
11
+.NOTES
12
+ Author: Markus Fleschutz | License: CC0
13
+#>
14
+
15
+function GetLogsDir {
16
+ if ($IsLinux) { return "/var/logs" }
17
+ $WinDir = [System.Environment]::GetFolderPath('Windows')
18
+ return "$WinDir\Logs"
19
+}
20
21
+try {
22
+ $Path = GetLogsDir
23
+ Set-Location "$Path"
24
+ "📂$Path"
25
+ exit 0 # success
26
+} catch {
27
+ "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
28
+ exit 1
29
0 commit comments