Su's Blog

Kratos
专注于用户阅读体验的响应式博客主题
Uncategorized

复制备份到usb盘

@echo off setlocal enabledelayedexpansion set "SRC=D:\backup" set "DEST=E:\server_backup" if not exist "%DEST%" mkdir "%DEST%" echo ===== Copy backup files (skip existing) ===== REM 复制文件(存在则跳过,不覆盖) robocopy "%SRC%" "%DEST%" backup_*.zip /XO /R:0 /W:0 >nul echo ===== Keep only latest 10 files ===== REM 获取文件列表(按时间排序:最新在后面) set count=0 for /f "delims=" %%F in ('dir "%DEST%\backup_*.zip" /b /o:-d') do ( set /a count+=1 if !count! GTR 10 ( del /f /q "%DEST%\%%F" ) ) echo Done. endlocal

June 15, 2026 0comments 6hotness 0likes Su Read all
Uncategorized

自动备份quickbooks脚本,保留10份

@echo off setlocal enabledelayedexpansion set SRC=SharedFiles\Quickbooks DATA set BACKUP=D:\backup set TMP=D:\QB_TMP set FILE_FILTER=*.qbw* set BACKUP_PREFIX=backup_ for /f %%i in ('powershell -NoProfile -Command "Get-Date -Format yyyy-MM-dd_HH-mm-ss"') do set DT=%%i set ZIP=%BACKUP%\%BACKUP_PREFIX%%DT%.zip if not exist "%TMP%" mkdir "%TMP%" if not exist "%BACKUP%" mkdir "%BACKUP%" echo ===================================== echo 1. Create VSS snapshot echo ===================================== ( echo SET CONTEXT PERSISTENT NOWRITERS echo ADD VOLUME D: ALIAS QBVOL echo CREATE echo EXPOSE %%QBVol%% X: ) > "%TMP%\vss.txt" diskshadow /s "%TMP%\vss.txt" echo ===================================== echo 2. Copy from VSS (X:) echo ===================================== robocopy "X:\%SRC%" "%TMP%" %FILE_FILTER% /R:1 /W:1 echo ===================================== echo 3. Remove snapshot (safe) echo ===================================== echo DELETE SHADOWS ALL > "%TMP%\vss_del.txt" diskshadow /s "%TMP%\vss_del.txt" echo ===================================== echo 4. Compress with PowerShell echo ===================================== powershell -NoProfile -Command "Compress-Archive -Path '%TMP%\*.qbw*' -DestinationPath '%ZIP%' -Force" echo ===================================== echo 5. Cleanup temp echo ===================================== rmdir /s /q "%TMP%" echo ===================================== echo 6. Keep last 10 backups echo ===================================== cd /d "%BACKUP%" for /f "skip=10 delims=" %%f in ('dir %BACKUP_PREFIX%*.zip /b /o-d') do ( del "%%f" ) echo DONE endlocal

June 3, 2026 0comments 72hotness 0likes Su Read all
Uncategorized

add record to hosts file

@echo off setlocal enabledelayedexpansion :: ===== 自动提权 ===== net session >nul 2>&1 if %errorlevel% neq 0 ( powershell -Command "Start-Process cmd -ArgumentList '/c %~f0' -Verb RunAs" exit ) :: ===== hosts 文件 ===== set "HOST_FILE=%SystemRoot%\System32\drivers\etc\hosts" set "TMP_FILE=%HOST_FILE%.tmp" :: ===== 去掉只读 ===== attrib -r "%HOST_FILE%" :: ===== 拷贝原 hosts 到临时文件 ===== copy /Y "%HOST_FILE%" "%TMP_FILE%" >nul :: ===== 要添加/更新的记录 ===== ( echo 127.0.0.1 www.2brightsparks.com echo 127.0.0.1 dbinternal.2brightsparks.com ) > "%HOST_FILE%.list" :: ===== 处理每条记录 ===== for /f "usebackq tokens=1,* delims= " %%i in ("%HOST_FILE%.list") do ( set "IP=%%i" set "DOMAIN=%%j" set "FOUND=0" set "NEW_TMP=%TMP_FILE%.new" if exist "!NEW_TMP!" del /f /q "!NEW_TMP!" :: 遍历原临时文件 for /f "usebackq delims=" %%L in ("%TMP_FILE%") do ( set "LINE=%%L" echo !LINE! | findstr /R /C:"[ ]!DOMAIN!" >nul if !errorlevel! EQU 0 ( echo !IP! !DOMAIN!>>"!NEW_TMP!" set "FOUND=1" ) else ( echo !LINE!>>"!NEW_TMP!" ) ) :: 如果没有找到域名,追加 if !FOUND! EQU 0 ( echo !IP! !DOMAIN!>>"!NEW_TMP!" ) move /Y "!NEW_TMP!" "%TMP_FILE%" >nul echo Added/Updated !IP! !DOMAIN! ) :: ===== 写回 hosts ===== move /Y "%TMP_FILE%" "%HOST_FILE%" >nul :: ===== 删除临时 list ===== del /f /q "%HOST_FILE%.list" :: ===== 恢复只读 ===== :: attrib +r "%HOST_FILE%" :: ===== 刷新 DNS ===== ipconfig /flushdns echo ==== Done ==== pause

April 1, 2026 0comments 205hotness 0likes Su Read all
Uncategorized

windows 11 右键菜单全展开

powershell reg add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve

March 8, 2026 0comments 494hotness 0likes Su Read all
Uncategorized

visual studio 2026 winform designer illegal characters in path 解决方法

visual studio 2026 winform designer illegal characters in path 解决方法 修改文件 C:\Program Files\Microsoft Visual Studio\18\Community\Common7\IDE\devenv.exe.config

December 10, 2025 0comments 775hotness 0likes Su Read all
Uncategorized

小米路由器hd-pro刷了Breed后,再刷openwrt后无法启动问题解决方法

小米路由器hd-pro刷了Breed后,再刷openwrt后无法启动问题解决方法 在Breed Web恢复控制台中的 环境变量编辑中 添加字段 xiaomi.r3g.bootfw 值为 2 就可以了。

October 13, 2025 0comments 967hotness 0likes Su Read all
Uncategorized

Rocky Linux 9 自动登录

Rocky Linux 9 自动登录 只要在 /etc/gdm/custom.conf文件中的加下以下语句 [daemon] AutomaticLogin=用户名 AutomaticLoginEnable=True

April 13, 2024 0comments 3273hotness 0likes Su Read all
Uncategorized

CS-CART 种类页显示 add to cart按纽

CS-CART 种类页显示 add to cart按纽 /design/themes/responsive/templates/blocks/product_list_templates/products_multicolumns.tpl show_add_to_cart=$show_add_to_cart|default:false 改成 show_add_to_cart=$show_add_to_cart|default:true

January 23, 2023 0comments 3572hotness 0likes Su Read all
Uncategorized

SmartLife 涂鸦Wifi电机配对

先按三下复位键,然后第4下长按直到灯长闪 遥控配对 按5秒直到灯长亮,然后按遥控器上的关闭键

November 24, 2022 0comments 3551hotness 0likes Su Read all
Uncategorized

Openwrt访客Wifi命令行快速设置

使用putty ssh连接openwrt路由器,进行设置访客wifi,访客ip段设为192.168.100.1, SSID为 guest-wifi Configure network uci -q delete network.guest_devuci set network.guest_dev="device"uci set network.guest_dev.type="bridge"uci set network.guest_dev.name="br-guest"uci -q delete network.guestuci set network.guest="interface"uci set network.guest.proto="static"uci set network.guest.device="br-guest"uci set network.guest.ipaddr="192.168.100.1"uci set network.guest.netmask="255.255.255.0"uci commit network/etc/init.d/network restart Configure wireless WIFI_DEV="$(uci get wireless.@wifi-iface[0].device)"uci -q delete wireless.guestuci set wireless.guest="wifi-iface"uci set wireless.guest.device="${WIFI_DEV}"uci set wireless.guest.mode="ap"uci set wireless.guest.network="guest"uci set wireless.guest.ssid="guest-wifi"uci set wireless.guest.encryption="none"uci commit wirelesswifi reload Configure DHCP uci -q delete dhcp.guestuci set dhcp.guest="dhcp"uci set dhcp.guest.interface="guest"uci set dhcp.guest.start="100"uci set dhcp.guest.limit="150"uci set dhcp.guest.leasetime="1h"uci set dhcp.guest.netmask="255.255.255.0"uci commit dhcp/etc/init.d/dnsmasq restart Configure firewall uci -q delete firewall.guestuci set firewall.guest="zone"uci set firewall.guest.name="guest"uci set firewall.guest.network="guest"uci set firewall.guest.input="REJECT"uci set firewall.guest.output="ACCEPT"uci set firewall.guest.forward="REJECT"uci -q delete firewall.guest_wanuci set firewall.guest_wan="forwarding"uci set firewall.guest_wan.src="guest"uci set firewall.guest_wan.dest="wan"uci -q delete firewall.guest_dnsuci set firewall.guest_dns="rule"uci set firewall.guest_dns.name="Allow-DNS-Guest"uci set firewall.guest_dns.src="guest"uci set firewall.guest_dns.dest_port="53"uci set firewall.guest_dns.proto="tcp udp"uci set firewall.guest_dns.target="ACCEPT"uci -q delete firewall.guest_dhcpuci set firewall.guest_dhcp="rule"uci set firewall.guest_dhcp.name="Allow-DHCP-Guest"uci set firewall.guest_dhcp.src="guest"uci set firewall.guest_dhcp.src_port="68"uci set firewall.guest_dhcp.dest_port="67"uci set firewall.guest_dhcp.proto="udp"uci set firewall.guest_dhcp.family="ipv4"uci set firewall.guest_dhcp.target="ACCEPT"uci commit firewall/etc/init.d/firewall restart 引用:https://openwrt.org/docs/guide-user/network/wifi/guestwifi/guest-wlan

October 18, 2022 0comments 3765hotness 0likes Su Read all
12
Archives
  • June 2026
  • April 2026
  • March 2026
  • December 2025
  • October 2025
  • April 2024
  • January 2023
  • November 2022
  • October 2022
  • September 2022
  • April 2019
Categories
  • Linux
  • Uncategorized

COPYRIGHT © 2024 Su's Blog. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.