winupd/unpinapp.cmd

27 lines
661 B
Batchfile

@echo off
if not exist "%systemdrive%\Install\system\getvariables.cmd" (
echo Missing %systemdrive%\Install\system\getvariables.cmd
exit /b 1
)
call "%systemdrive%\Install\system\getvariables.cmd"
if [%pinappmod%] == [] (
echo PINAPPMOD not set!
exit /b 1
)
if not exist %pinappmod% (
echo Missing %pinappmod%
exit /b 1
)
set _lnkname=%1
if [%_lnkname%] == [] (
echo Usage: %0 ^<lnkname^>
exit /b 1
)
for /r "%appdir%\Microsoft\Internet Explorer\Quick Launch\User Pinned\Taskbar" %%j in ("%_lnkname%*.lnk") do (
echo Removing %%j
powershell -Command "& import-module %pinappmod%; Set-PinnedApplication -Action UnPinFromTaskbar -FilePath ""%%j"""
)