[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[系统相关] 批处理怎样修改鼠标指针文件?

请教:
我想临时修改一下系统正在使用鼠标指针文件,比如:
——我并不知道系统正在使用的是啥鼠标指针文件,但是,我想临时使用一下“zhuxing.cur”这个鼠标指针,使用完后,又要还原到之前系统使用的鼠标指针文件。

请教怎么才能办到??谢谢!!

直接在main.cpl的指针选项卡修改,还可以在注册表项HKCU\Control Panel\Cursors修改,不过修改注册表要重启。

TOP

直接在main.cpl的指针选项卡修改,还可以在注册表项HKCU\Control Panel\Cursors修改,不过修改注册表要重启 ...
buyiyang 发表于 2023-3-14 17:04



    谢谢您的回答!但,不完全符合我的想法!
在这里提问题,我当然是想用命令行或BAT来解决的了!

TOP

  1. set "curfile=C:\zhuxing.cur"
  2. cd /d "%~dp0"
  3. if not exist recover.reg (reg export "HKCU\Control Panel\Cursors" recover.reg)
  4. reg query "HKCU\Control Panel\Cursors" /v Arrow | findstr /c:"%curfile%" && goto re
  5. reg add "HKCU\Control Panel\Cursors" /v Arrow /t REG_EXPAND_SZ /d "%curfile%" /f
  6. shutdown -l
  7. exit
  8. :re
  9. reg import recover.reg
  10. shutdown -l
复制代码
设置好自定义的cur文件路径,这个bat脚本会判断切换或恢复鼠标arrow的cur,不过由于是修改注册表需要注销后生效,注意它会自动注销,生成的recover.reg不要删除。

TOP

设置好自定义的cur文件路径,这个bat脚本会判断切换或恢复鼠标arrow的cur,不过由于是修改注册表需要注销后 ...
buyiyang 发表于 2023-3-15 10:52



    谢谢了!
美中不足的不能立即生效!!

TOP

试试把注销换成这样
  1. powershell "Add-Type 'using System.Runtime.InteropServices;public static class test{[DllImport(\"user32.dll\", EntryPoint = \"SystemParametersInfo\")]public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, uint pvParam, uint fWinIni);}';[test]::SystemParametersInfo(0x0057,0,$null,0)"
复制代码
2

评分人数

TOP

本帖最后由 locoman 于 2023-3-17 16:22 编辑
试试把注销换成这样
idwma 发表于 2023-3-16 16:57


谢谢您了!
实测:我手工在注册表中修改了鼠标指针后,再运行您这个powershell后,就立即生效了!!


再请教:
1. 您这段powershell代码只能对修改鼠标指针立即生效有作用?还是可以对所有注册表修改都能立即生效吗?
2. 您这段powershell代码与下面这两句有啥区别?使用哪个更好呢??
taskkill /f /im explorer.exe
start explorer.exe

3. 据此,将4楼的代码整合如下吗?

   

set "curfile=C:\zhuxing.cur"
cd /d "%~dp0"
if not exist recover.reg (reg export "HKCU\Control Panel\Cursors" recover.reg)
reg query "HKCU\Control Panel\Cursors" /v Arrow | findstr /c:"%curfile%" && goto re
reg add "HKCU\Control Panel\Cursors" /v Arrow /t REG_EXPAND_SZ /d "%curfile%" /f
powershell "Add-Type 'using System.Runtime.InteropServices;public static class test{[DllImport(\"user32.dll\", EntryPoint = \"SystemParametersInfo\")]public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, uint pvParam, uint fWinIni);}';[test]::SystemParametersInfo(0x0057,0,$null,0)"
exit
:re
reg import recover.reg
powershell "Add-Type 'using System.Runtime.InteropServices;public static class test{[DllImport(\"user32.dll\", EntryPoint = \"SystemParametersInfo\")]public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, uint pvParam, uint fWinIni);}';[test]::SystemParametersInfo(0x0057,0,$null,0)"

TOP

回复 7# locoman

这个api改参数才能让对应的设置生效
https://learn.microsoft.com/zh-c ... stemparametersinfoa
结束进程的方式也好呀,适合自己就是最好的

TOP

返回列表