Skip to content

Commit f21e3ab

Browse files
authored
Refactor Std-File.ps1 for improved execution handling
1 parent 8a0f842 commit f21e3ab

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Source/assets/scripts/Std-File.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ switch ($extension) {
1919
{ $_ -in @('.cmd', '.bat') } {
2020
# CMD/BAT: Execute via cmd.exe with proper working directory
2121
# Using cd /d ensures correct drive and directory, && ensures file only runs if cd succeeds
22+
Write-Host "Running: $fullFilePath..."
2223
Start-Process cmd.exe -ArgumentList "/c cd /d `"$sandboxPath`" && `"$FileName`""
2324
}
2425
'.ps1' {
2526
# PS1: Execute via powershell.exe with working directory set
27+
Write-Host "Running: $fullFilePath..."
2628
Start-Process powershell.exe -ArgumentList "-File `"$fullFilePath`"" -WorkingDirectory $sandboxPath
2729
}
2830
'.intunewin' {
@@ -115,13 +117,16 @@ switch ($extension) {
115117
}
116118

117119
# Execute the .ahk/.au3 file
120+
Write-Host "Running: $fullFilePath..."
118121
Start-Process $fullFilePath -WorkingDirectory $sandboxPath
119122
}
120123
default {
121124
# Default: Direct execution with working directory
122125
# Works for: .exe, .msi, .msix, .appx, .js, .py, etc.
126+
Write-Host "Running: $fullFilePath..."
123127
Start-Process $fullFilePath -WorkingDirectory $sandboxPath
124128
}
125129
}
126130

127131

132+

0 commit comments

Comments
 (0)