1.Compare秘钥问题
@echo off
echo 开始破解Compare秘钥问题......
set path=C:\Users\Administrator\AppData\Roaming\Scooter Software\Beyond Compare 4
cd %path%
C:
echo 删除问题文件,请输入 Y 进行确认!
del *.*
echo 秘钥问题解决......!
echo. & pausve
2.help-v 相关
2.1部署
pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt
for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
del hyper-v.txt
Dism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL
2.2启动
bcdedit /set hypervisorlaunchtype auto
2.3关闭
bcdedit /set hypervisorlaunchtype off
3.删除空文件夹
@echo off
setlocal enabledelayedexpansion
del /q %~d0\empty_dir
del /q %~d0\directory.txt
REM 下面的代码加上sort /r ,表示逆序排列文件夹。子文件夹在前,父文件夹在后。
dir /a:d /b /s "." | sort /r > "%cd%\directory.txt"
for /f "usebackq delims=" %%i in ("directory.txt") do (
echo "enter dir is: %%i"
cd "%%i"
echo "the bat path is: %~f0" rem print this batfile's whole path.
echo "cur dir is: "%%i""
REM 将当前目录下的所有文件打印到以下文件中:
dir /a /b "%%i" >"c:\folder_content.txt"
echo "======================================================="
echo "==================fold content: begin ================="
:type "c:\folder_content.txt"
echo "==================fold content: end ================="
echo "======================================================="
REM 下面的findstr命令查找当前文件是否有内容,如果查找成功表示目录不是空的,否则是空的。
REM 注意下面的两个 '与' 和 两个 '或' 符号。
findstr . "%~d0\folder_content.txt" >nul 2>nul && ( echo "The folder "%%i" is NOT NOT NOT empty") || ( echo "The folder "%%i" is empty" && echo "%%i">>"%cd%\empty_dir" && rd "%%i")
::del "%~d0\folder_content.txt"
)
::del "%cd%\directory.txt"
pause
4.自动以管理员权限运行
@echo on
echo %session%
net.exe session 1>NUL 2>NUL && (
goto gotAdmin
) || (
goto UACPrompt
)
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
:begin
@echo off
pause
5.启动虚拟机相关权限
sc config VMAuthdService start= demand
sc start VMAuthdService
sc config VMwareHostd start= demand
sc start VMwareHostd
sc config VMUSBArbService start= demand
sc start VMUSBArbService
sc config VMUSBArbService start= demand
sc start VMUSBArbService
sc config VMware NAT Service start= demand
sc start VMware NAT Service
#pause
6.组策略部署
@echo off
pushd "%~dp0"
dir /b %systemroot%\Windows\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientExtensions-Package~3*.mum >gp.txt
dir /b %systemroot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package~3*.mum >>gp.txt
for /f %%i in ('findstr /i . gp.txt 2^>nul') do dism /online /norestart /add-package:"%systemroot%\servicing\Packages\%%i"
pause
7.检测当前用户权限
echo off
net.exe session 1>NUL 2>NUL && (
goto as_admin
) || (
goto not_admin
)
:as_admin
echo as_admin
goto end
:not_admin
echo not as admin
:end
pause