好友
阅读权限10
听众
最后登录1970-1-1
|
将下面文本复制到记事本,另存为bat文件即可。
::===============================================================================================================
@echo off
mode con:cols=90 lines=30
title RustDesk ID 修改
net file 1>nul 2>nul && goto :Main || powershell -ex unrestricted -Command "Start-Process -Verb RunAs -FilePath '%comspec%' -ArgumentList '/c ""%~fnx0""""'"
goto :eof
::===============================================================================================================
:Main
cls
if exist "C:\Program Files\RustDesk\rustdesk.exe" (
cd "C:\Program Files\RustDesk\"
for /f "delims=" %%i in ('rustdesk.exe --get-id ^| more') do set rustdesk_id=%%i
goto :Run
) else (
echo.
echo RustDesk未安装, 请先安装RustDesk。
echo.
echo 按任意键退出。
pause >nul
exit
)
:Run
pushd %temp% >nul 2>&1
echo.
echo ==========================================================================================
echo.
echo RustDesk ID 修改器(仁兄)
echo.
echo 1 - 使用计算机名设置RustDesk ID:"%computername%";
echo.
echo 2 - 使用10位随机数设置RustDesk ID;
echo.
echo 3 - 将RustDesk ID设置为您指定的值;
echo.
echo 4 - 退出。
echo.
echo ==========================================================================================
echo.
choice /c 1234 /cs /n /m "请输入编号 :"
echo.
if errorlevel 4 Exit
if errorlevel 3 goto :ID_UserDefined
if errorlevel 2 goto :ID_Random
if errorlevel 1 goto :ID_Host
echo.
::===============================================================================================================
:ID_Host
echo.
echo Stop-Service RustDesk > RustDesk_ID_Host.ps1
echo taskkill /im rustdesk.exe /f >> RustDesk_ID_Host.ps1
echo $id = Get-Content "C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config\RustDesk.toml" ^| Select-Object -Index 0 >> RustDesk_ID_Host.ps1
echo $hostname = hostname >> RustDesk_ID_Host.ps1
echo Write-Host "当前RustDeskID:%rustdesk_id%" >> RustDesk_ID_Host.ps1
echo $newId = "id = '$hostname'" >> RustDesk_ID_Host.ps1
echo Write-Host "新的RustDeskID:$newId" >> RustDesk_ID_Host.ps1
echo $fileContent = Get-Content -Path "C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config\RustDesk.toml" >> RustDesk_ID_Host.ps1
echo $newContent = $fileContent -replace [regex]::Escape($id), $newId >> RustDesk_ID_Host.ps1
echo $newContent ^| Set-Content -Path "C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config\RustDesk.toml" >> RustDesk_ID_Host.ps1
echo Restart-Service RustDesk >> RustDesk_ID_Host.ps1
powershell.exe -ExecutionPolicy Bypass -File RustDesk_ID_Host.ps1
start "" "C:\Program Files\RustDesk\rustdesk.exe" --tray
goto :done
::===============================================================================================================
:ID_Random
echo.
echo Stop-Service RustDesk > RustDesk_ID_Random.ps1
echo taskkill /im rustdesk.exe /f >> RustDesk_ID_Random.ps1
echo $randomId = -join ((48..57) ^| Get-Random -Count 10 ^| ForEach-Object {[char]$_}) >> RustDesk_ID_Random.ps1
echo $id = Get-Content "C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config\RustDesk.toml" ^| Select-Object -Index 0 >> RustDesk_ID_Random.ps1
echo Write-Host "当前RustDeskID:%rustdesk_id%" >> RustDesk_ID_Random.ps1
echo $newId = "id = '$randomId'" >> RustDesk_ID_Random.ps1
echo Write-Host "新的RustDeskID:$newId" >> RustDesk_ID_Random.ps1
echo $fileContent = Get-Content -Path "C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config\RustDesk.toml" >> RustDesk_ID_Random.ps1
echo $newContent = $fileContent -replace [regex]::Escape($id), $newId >> RustDesk_ID_Random.ps1
echo $newContent ^| Set-Content -Path "C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config\RustDesk.toml" >> RustDesk_ID_Random.ps1
echo Restart-Service RustDesk >> RustDesk_ID_Random.ps1
powershell.exe -ExecutionPolicy Bypass -File RustDesk_ID_Random.ps1
start "" "C:\Program Files\RustDesk\rustdesk.exe" --tray
goto :done
::===============================================================================================================
:ID_UserDefined
echo.
echo Stop-Service RustDesk > RustDesk_ID_UserDefined.ps1
echo taskkill /im rustdesk.exe /f >> RustDesk_ID_UserDefined.ps1
echo $id = Get-Content "C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config\RustDesk.toml" ^| Select-Object -Index 0 >> RustDesk_ID_UserDefined.ps1
echo 新的RustDeskID6-14位,可为大小写字母、数字、符号组合。
timeout /t 2 >nul 2>&1
echo.
echo $newId = Read-Host "输入RustDeskID:" >> RustDesk_ID_UserDefined.ps1
echo Write-Host "当前RustDeskID: %rustdesk_id%" >> RustDesk_ID_UserDefined.ps1
echo $newId = "id = '$newId'" >> RustDesk_ID_UserDefined.ps1
echo Write-Host "新的RustDeskID:$newId" >> RustDesk_ID_UserDefined.ps1
echo $fileContent = Get-Content -Path "C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config\RustDesk.toml" >> RustDesk_ID_UserDefined.ps1
echo $newContent = $fileContent -replace [regex]::Escape($id), $newId >> RustDesk_ID_UserDefined.ps1
echo $newContent ^| Set-Content -Path "C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config\RustDesk.toml" >> RustDesk_ID_UserDefined.ps1
echo Restart-Service RustDesk >> RustDesk_ID_UserDefined.ps1
powershell.exe -ExecutionPolicy Bypass -File RustDesk_ID_UserDefined.ps1
start "" "C:\Program Files\RustDesk\rustdesk.exe" --tray
goto :done
::===============================================================================================================
:done
del RustDesk_ID_Host.ps1 >nul 2>&1
del RustDesk_ID_Random.ps1 >nul 2>&1
del RustDesk_ID_UserDefined.ps1 >nul 2>&1
echo.
echo 设置完成!!!
echo.
choice /C:MX /N /M "按M键回到主菜单,按X键推出:"
if errorlevel 2 Exit
if errorlevel 1 goto :Main
::===============================================================================================================
|
免费评分
-
查看全部评分
|
发帖前要善用【论坛搜索】功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。 |
|
|
|
|
|