-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwpshellscripts.ps1
47 lines (40 loc) · 1.63 KB
/
wpshellscripts.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
########################################################
# MAIN Script with custom Windows Power Shell Functions
########################################################
$global:newjet = "C:\gitprojects\project_building_tools\create_project_structure.py"
$global:gitprojects = "C:\gitprojects"
$global:newjet = "C:\gitprojects\project_building_tools\[email protected]"
$global:desktop = "C:\Users\mauricmm\iCloudDrive\#Desktop"
$global:gitprojects = "C:\gitprojects"
$uioadmin = "C:\Program Files\UiO Temporary Administrator\2.0.2\temp-admin-user.exe"
$exportenvs = "C:\gitprojects\project_building_tools\_scripts\export_envs.ps1"
$cloudgit = "C:\Users\mauricmm\iCloudDrive\cloudgit"
function touch {
<#
.SYNOPSIS
Creates a new empty file or updates the timestamp of an existing file, with optional content.
.EXAMPLE
# Create a file named "test.txt" in the current directory
touch -path "test.txt"
# Create a file with specified content
touch -path "C:\girprojects\test.txt" -content "This is the file content."
#>
param (
[string]$path = "",
[string]$content = ""
)
# If no path is provided, use the current directory
if ($path -eq "") {
$path = Join-Path -Path (Get-Location) -ChildPath "newfile.txt"
}
if (Test-Path $path) {
# Error message if the file already exists
Write-Error "File '$path' already exists."
} else {
# Create a new file with optional content
New-Item -Path $path -ItemType File -Force | Out-Null
if ($content -ne "") {
Set-Content -Path $path -Value $content
}
}
}