launcher cmd added
This commit is contained in:
parent
3739c3eec1
commit
c32157bfda
|
|
@ -0,0 +1,15 @@
|
||||||
|
@echo off
|
||||||
|
setlocal EnableDelayedExpansion
|
||||||
|
set "action=%~1"
|
||||||
|
set "filepath=%~2"
|
||||||
|
set "scriptdir=%~dp0"
|
||||||
|
|
||||||
|
if "%action%"=="add" (
|
||||||
|
set "script=%scriptdir%Freigabe-Hinzufuegen.ps1"
|
||||||
|
) else if "%action%"=="remove" (
|
||||||
|
set "script=%scriptdir%Freigabe-Entfernen.ps1"
|
||||||
|
) else (
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File "%script%" -Path "%filepath%"
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
' 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,7 +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"
|
$launcherCmd = Join-Path $scriptDir "Freigabe-Launcher.cmd"
|
||||||
|
|
||||||
if ($ForAllUsers) {
|
if ($ForAllUsers) {
|
||||||
if (-not (Test-Administrator)) {
|
if (-not (Test-Administrator)) {
|
||||||
|
|
@ -165,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 /s /c `"wscript.exe `"$launcherScript`" add `"`"%V`"`"`""
|
Set-ItemProperty -Path $freigabeCmd -Name "(Default)" -Value "cmd.exe /c `"`"$launcherCmd`" add `"%V`"`""
|
||||||
} else {
|
} else {
|
||||||
Set-ItemProperty -Path $freigabeCmd -Name "(Default)" -Value "cmd /s /c `"wscript.exe `"$launcherScript`" add `"`"%1`"`"`""
|
Set-ItemProperty -Path $freigabeCmd -Name "(Default)" -Value "cmd.exe /c `"`"$launcherCmd`" add `"%1`"`""
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-not (Test-Path $entfernenKey)) {
|
if (-not (Test-Path $entfernenKey)) {
|
||||||
|
|
@ -182,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 /s /c `"wscript.exe `"$launcherScript`" remove `"`"%V`"`"`""
|
Set-ItemProperty -Path $entfernenCmd -Name "(Default)" -Value "cmd.exe /c `"`"$launcherCmd`" remove `"%V`"`""
|
||||||
} else {
|
} else {
|
||||||
Set-ItemProperty -Path $entfernenCmd -Name "(Default)" -Value "cmd /s /c `"wscript.exe `"$launcherScript`" remove `"`"%1`"`"`""
|
Set-ItemProperty -Path $entfernenCmd -Name "(Default)" -Value "cmd.exe /c `"`"$launcherCmd`" remove `"%1`"`""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue