Snippets for getting the old name in name change scripts, sanitizing filenames for Windows, and renaming files.
This commit is contained in:
parent
8c1e08d49f
commit
ac8773c363
3 changed files with 7 additions and 0 deletions
1
LANCommander/Snippets/Examples/Rename File.ps1
Normal file
1
LANCommander/Snippets/Examples/Rename File.ps1
Normal file
|
@ -0,0 +1 @@
|
|||
Rename-Item -Path "$InstallDir\<FilePath>" -NewName "$InstallDir\<NewName>"
|
2
LANCommander/Snippets/Examples/Sanitize Filename.ps1
Normal file
2
LANCommander/Snippets/Examples/Sanitize Filename.ps1
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Takes the variable $Filename, splits it by invalid characters, then joins using _
|
||||
$Filename.Split([IO.Path]::GetInvalidFileNameChars()) -join '_'
|
4
LANCommander/Snippets/Variables/OldName.ps1
Normal file
4
LANCommander/Snippets/Variables/OldName.ps1
Normal file
|
@ -0,0 +1,4 @@
|
|||
$OldName = ""
|
||||
if ($args[1]) {
|
||||
$OldName = $args[1]
|
||||
}
|
Loading…
Add table
Reference in a new issue