File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 1- <#
1+ # Requires -Version 5.0
22
3+ <#
34. SYNOPSIS
45Automatically backups all remote GitHub repositories.
56
@@ -26,8 +27,8 @@ Overrides the default backup directory.
2627
2728. EXAMPLE
2829.\backup_github_repositories.ps1 -backupDirectory "C:\myBackupDirectory"
29-
3030#>
31+
3132[CmdletBinding ()]
3233Param (
3334
@@ -45,9 +46,16 @@ Param (
4546
4647 [string ]$organisationName ,
4748
48- [string ]$backupDirectory = $ ( Join-Path - Path $PSScriptRoot - ChildPath $ ( Get-Date - UFormat " %Y-%m-%d " ))
49+ [string ]$backupDirectory
4950)
5051
52+ # Default the backup directory to './YYYY-MM-DD'. This can
53+ # not be done in the Param section because $PSScriptRoot
54+ # will not be resolved if this script gets invoked from cmd.
55+ if (! $backupDirectory ) {
56+ $backupDirectory = $ (Join-Path - Path " $PSScriptRoot " - ChildPath $ (Get-Date - UFormat " %Y-%m-%d" ))
57+ }
58+
5159#
5260# Clone a remote GitHub repository into a local directory.
5361#
You can’t perform that action at this time.
0 commit comments