vbs.script launcher für sonderzeichen
This commit is contained in:
parent
363a4a8dfa
commit
dbee26db5f
|
|
@ -0,0 +1,24 @@
|
||||||
|
' Launcher fuer Freigabe-Skripte
|
||||||
|
' Umgeht Probleme mit Sonderzeichen (& etc.) in Pfaden
|
||||||
|
|
||||||
|
Set objArgs = WScript.Arguments
|
||||||
|
If objArgs.Count < 2 Then
|
||||||
|
WScript.Quit 1
|
||||||
|
End If
|
||||||
|
|
||||||
|
strAction = objArgs(0)
|
||||||
|
strPath = objArgs(1)
|
||||||
|
|
||||||
|
Set objShell = CreateObject("WScript.Shell")
|
||||||
|
strScriptDir = Replace(WScript.ScriptFullName, WScript.ScriptName, "")
|
||||||
|
|
||||||
|
If strAction = "add" Then
|
||||||
|
strScript = strScriptDir & "Freigabe-Hinzufuegen.ps1"
|
||||||
|
ElseIf strAction = "remove" Then
|
||||||
|
strScript = strScriptDir & "Freigabe-Entfernen.ps1"
|
||||||
|
Else
|
||||||
|
WScript.Quit 1
|
||||||
|
End If
|
||||||
|
|
||||||
|
strCommand = "powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File """ & strScript & """ -Path """ & strPath & """"
|
||||||
|
objShell.Run strCommand, 0, False
|
||||||
|
|
@ -118,6 +118,7 @@ function Install-ContextMenu {
|
||||||
$scriptDir = Get-ScriptDirectory
|
$scriptDir = Get-ScriptDirectory
|
||||||
$freigabeScript = Join-Path $scriptDir "Freigabe-Hinzufuegen.ps1"
|
$freigabeScript = Join-Path $scriptDir "Freigabe-Hinzufuegen.ps1"
|
||||||
$entfernenScript = Join-Path $scriptDir "Freigabe-Entfernen.ps1"
|
$entfernenScript = Join-Path $scriptDir "Freigabe-Entfernen.ps1"
|
||||||
|
$launcherScript = Join-Path $scriptDir "Freigabe-Launcher.vbs"
|
||||||
|
|
||||||
if ($ForAllUsers) {
|
if ($ForAllUsers) {
|
||||||
if (-not (Test-Administrator)) {
|
if (-not (Test-Administrator)) {
|
||||||
|
|
@ -164,9 +165,9 @@ function Install-ContextMenu {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($shellType -eq "Directory\Background\shell") {
|
if ($shellType -eq "Directory\Background\shell") {
|
||||||
Set-ItemProperty -Path $freigabeCmd -Name "(Default)" -Value "cmd /c powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File `"$freigabeScript`" -Path `"`"%V`"`""
|
Set-ItemProperty -Path $freigabeCmd -Name "(Default)" -Value "wscript.exe `"$launcherScript`" add `"%V`""
|
||||||
} else {
|
} else {
|
||||||
Set-ItemProperty -Path $freigabeCmd -Name "(Default)" -Value "cmd /c powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File `"$freigabeScript`" -Path `"`"%1`"`""
|
Set-ItemProperty -Path $freigabeCmd -Name "(Default)" -Value "wscript.exe `"$launcherScript`" add `"%1`""
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-not (Test-Path $entfernenKey)) {
|
if (-not (Test-Path $entfernenKey)) {
|
||||||
|
|
@ -181,9 +182,9 @@ function Install-ContextMenu {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($shellType -eq "Directory\Background\shell") {
|
if ($shellType -eq "Directory\Background\shell") {
|
||||||
Set-ItemProperty -Path $entfernenCmd -Name "(Default)" -Value "cmd /c powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File `"$entfernenScript`" -Path `"`"%V`"`""
|
Set-ItemProperty -Path $entfernenCmd -Name "(Default)" -Value "wscript.exe `"$launcherScript`" remove `"%V`""
|
||||||
} else {
|
} else {
|
||||||
Set-ItemProperty -Path $entfernenCmd -Name "(Default)" -Value "cmd /c powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File `"$entfernenScript`" -Path `"`"%1`"`""
|
Set-ItemProperty -Path $entfernenCmd -Name "(Default)" -Value "wscript.exe `"$launcherScript`" remove `"%1`""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue