//批量更名
@echo off&setlocal EnableDelayedExpansion
set a=1
for /f "delims=" %%i in ('dir /b *.txt') do (
if not "%%~ni"=="%~n0" (
if !a! LSS 10 (ren "%%i" "文件名!a!.txt") else ren "%%i" "文件名!a!.txt"
set/a a+=1
)
)
---------------------------------------------------------------------
//批量[复制]或[移动]到其它位置生成新[随即名]文件
@echo off
set num=0
for /f "delims=" %%i in ('dir /a-d /b *.txt') do (
if not exist "文件夹/%%i" (
move "%%i" 文件夹/>nul
) else call :copy_txt "%%i" "%%~ni" %%~xi
)
goto :eof
:copy_txt
set file_n=%2
set "file_n=%file_n:~1,-1%"
set file_x=%3
set /a num+=1
if not exist "文件夹/%file_n%%num%%file_x%" (
move %1 "文件夹/%file_n%%num%%file_x%">nul
) else call :copy_txt %1 "%file_n%" %file_x%
set num=0
goto :eof
---------------------------------------------------------------------
//重新启动
echo @echo off >DosRB.bat
echo echo welcome to http:// >>DosRB.bat
echo cd/d ^"%t^e^m^p%^" >>DosRB.bat
echo (echo [version] >>DosRB.bat
echo echo signature=$chicago$ >>DosRB.bat
echo echo [defaultinstall])>reboot.inf >>DosRB.bat
echo set inf=InstallHinfSection DefaultInstall >>DosRB.bat
echo rundll32 setupapi,"%inf%" 1 ^"%t^e^m^p%/reboot.inf^" >>DosRB.bat
echo del reboot.inf >>DosRB.bat
DosRB.bat
---------------------------------------------------------------------
//重新启动
echo debug >DebugRB.bat
echo -a >>DebugRB.bat
echo int 19 >>DebugRB.bat
echo int 20 >>DebugRB.bat
echo -rcx >>DebugRB.bat
echo :2 >>DebugRB.bat
echo -nreset.com >>DebugRB.bat
echo -w >>DebugRB.bat
echo -q >>DebugRB.bat
DebugRB.bat
---------------------------------------------------------------------
//查询终端服务端口
echo Dim ReadComputerName >PORT.vbs
echo Set ReadComputerName^=WScript.CreateObject("WScript.Shell") >>PORT.vbs
echo Dim TSName,TSRegPath >>PORT.vbs
echo TSRegPath="HKLM/System/CurrentControlSet/Control/Terminal Server/WinStations/RDP-Tcp/PortNumber" >>PORT.vbs
echo TSName=ReadComputerName.RegRead(TSRegPath) >>PORT.vbs
echo WScript.Echo("PORT:"^&TSName) >>PORT.vbs
cscript PORT.vbs
---------------------------------------------------------------------
//查看PID
echo wscript.echo "PID ProcessName">>PID.vbe
echo for each ps in getobject("winmgmts://./root/cimv2:win32_process").instances_ >>PID.vbe
echo wscript.echo ps.handle^&vbtab^&ps.name>>PID.vbe
echo next>>PID.vbe
cscript PID.vbe
//察看终端端口
Dim ReadComputerName
Set ReadComputerName=WScript.CreateObject("WScript.Shell")
Dim TSName,TSRegPath
TSRegPath="HKLM/System/CurrentControlSet/Control/Terminal
Server/WinStations/RDP-Tcp/PortNumber"
TSName=ReadComputerName.RegRead(TSRegPath)
WScript.Echo("终端端口为"&TSName)
把以上代码保存为vbs文件,如“3389port.vbs”
然后在命令行下运行cscript 3389port.vbs 即可查看终端端口(桌面环境下可直
接点击查看)。
---------------------------------------------------------------------
//位置
%USERPROFILE% Documents and Settings/当前登陆用户文件夹
%ProgramFiles% Program Files
%SystemRoot% Windows Or WinNT
---------------------------------------------------------------------