标题: 如何让使用批处理添加reg的键值????
[打印本页]
作者: coolclack
时间: 2007-6-26 01:10
标题: 如何让使用批处理添加reg的键值????
只想修改[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders]
里的 desktop 为 d:\123 原来是%...%桌面
试了哈下面的
@Echo off
regedit /s regfile.reg
taskkill /im explorer.exe /f
explorer.exe
RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters
exit
需要要先有reg文件 才能用 regedit /s 导入 才能添加吗??
能不能直接用1个bat 把注册表键值添加了
运行taskkill /im explorer.exe /f 能不能不让任务栏消失 也能刷新桌面?
我用的bat最后为什么dos窗口还没有关闭
如果能用vbs实现哪更好拉!!!
作者: lxmxn
时间: 2007-6-26 02:52
修改注册表可以用 reg 命令。
作者: recooliu
时间: 2007-6-26 08:56
使用REG ADD命令可以做到~~~~
Quote: |
Windows 控制台注册表工具 - 版权所有 (C) Microsoft Corp. 1981-2001. 保留所有权繰EG ADD KeyName [/v ValueName | /ve] [/t Type] [/s Separator] [/d Data] [/f]
KeyName [\\Machine\]FullKey
远程机器的机器名 - 忽略默认到当前机器。
远程机器上只有 HKLM 和 HKU。
FullKey ROOTKEY\SubKey
ROOTKEY [ HKLM | HKCU | HKCR | HKU | HKCC ]
SubKey 所选 ROOTKEY 下注册表项的完整名
/v 所选项之下要添加的值名
/ve 为注册表项添加空白值名<无名称>
/t RegKey 数据类型
[ REG_SZ | REG_MULTI_SZ | REG_DWORD_BIG_ENDIAN |
REG_DWORD | REG_BINARY | REG_DWORD_LITTLE_ENDIAN |
REG_NONE | REG_EXPAND_SZ ]
如果忽略,则采用 REG_SZ
/s 指定一个在 REG_MULTI_SZ 数据字符串中
用作分隔符的字符
如果忽略,则将 "\0" 用作分隔符
/d 要分配给添加的注册表 ValueName 的数据
/f 不用提示就强行改写现有注册表项
例如:
REG ADD \\ABC\HKLM\Software\MyCo
添加远程机器 ABC 上的一个注册表项 HKLM\Software\MyCo
REG ADD HKLM\Software\MyCo /v Data /t REG_BINARY /d fe340ead
添加一个值(名称: Data,类型: REG_BINARY,数据: fe340ead)
REG ADD HKLM\Software\MyCo /v MRU /t REG_MULTI_SZ /d fax\0mail
添加一个值(名称: MRU,类型: REG_MUTLI_SZ,数据: fax\0 |
|
[
Last edited by recooliu on 2007-6-26 at 09:04 AM ]
作者: coolclack
时间: 2007-6-26 09:29
楼上的太复杂了
能说的具体点吗?
作者: HAT
时间: 2007-6-26 10:47
添加一个开机自启动项
@echo off
reg add HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run /v MyAutoRun /t REG_SZ /d C:/test.bat /f
作者: HAT
时间: 2007-6-26 10:51
具体到你的问题
@echo off
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Desktop /t REG_EXPAND_SZ /d d:\123 /f
作者: coolclack
时间: 2007-6-26 18:52
网吧的机器 你叫我要一台一台的添吗??
作者: terse
时间: 2007-6-26 19:09
For /f "delims=" %%i in (远程机器.txt) do (
REG ADD \\%%i\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Desktop /t REG_EXPAND_SZ /d d:\123 /f
)
无法测试 :(
作者: HAT
时间: 2007-6-26 19:11
//网吧的机器 你叫我要一台一台的添吗??
在1楼不说清楚 你叫大家一个一个的猜吗??
^_^
作者: coolclack
时间: 2007-6-26 20:21
添加成了 后面2个问题呢?
[
Last edited by coolclack on 2007-6-26 at 08:24 PM ]
作者: dikex
时间: 2007-6-26 20:30
运行taskkill /im explorer.exe /f 能不能不让任务栏消失 也能刷新桌面?
不能
我用的bat最后为什么dos窗口还没有关闭
直接调用其他命令时会等待其他命令的结束才进行下一个命令的,
@Echo off
regedit /s regfile.reg
taskkill /im explorer.exe /f
start "" explorer.exe
start "" RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters
exit
作者: coolclack
时间: 2007-6-26 20:33
@echo off
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Desktop /t REG_EXPAND_SZ /d D:\123 /f
taskkill /im explorer.exe /f
start "" explorer.exe
start "" RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters
exit
应该没问题了吧?? 楼上的?!
作者: coolclack
时间: 2007-6-26 20:37
@echo off
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Desktop /t REG_EXPAND_SZ /d C:\Documents and settings\Administrator\桌面 /f
taskkill /im explorer.exe /f
start "" explorer.exe
start "" RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters
exit
哎呀!刷不会原来的桌面了
什么命令行参数太多?
作者: lasting
时间: 2007-6-26 22:09
刷新桌面不防用以下命令。。。‘
Quote: |
ntsd -c q -pn explorer.exe |
|
作者: terse
时间: 2007-6-26 22:19
试一下VBS:
path="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\"
set ws=wscript.createobject("wscript.shell")
t=ws.regwrite(path & "Desktop","D:\123")
ws.run "ntsd -c q -pn explorer.exe"
[
Last edited by terse on 2007-6-27 at 11:58 PM ]
作者: coolclack
时间: 2007-6-26 22:32
ntsd -c q -pn explorer.exe
啥意思??
出现个黑框框 然后很多东西一闪就过??
作者: lasting
时间: 2007-6-27 05:53
Quote: |
usage: ntsd [-?] [-2] [-d] [-g] [-G] [-myob] [-lines] [-n] [-o] [-s] [-v] [-w]
[-r BreakErrorLevel] [-t PrintErrorLevel]
[-hd] [-pd] [-pe] [-pt #] [-pv] [-x | -x{e|d|n|i} <event>]
[-- | -p pid | -pn name | command-line | -z CrashDmpFile]
[-zp CrashPageFile] [-premote transport] [-robp]
[-aDllName] [-c "command"] [-i ImagePath] [-y SymbolsPath]
[-clines #] [-srcpath SourcePath] [-QR \\machine] [-wake <pid>]
[-remote transport:server=name,portid] [-server transport:portid]
[-ses] [-sfce] [-sicv] [-snul] [-noio] [-failinc] [-noshell]
where: -? displays this help text
command-line is the command to run under the debugger
-- is the same as -G -g -o -p -1 -d -pd
-aDllName sets the default extension DLL
-c executes the following debugger command
-clines number of lines of output history retrieved by a remote client
-failinc causes incomplete symbol and module loads to fail
-d sends all debugger output to kernel debugger via DbgPrint
-d cannot be used with debugger remoting
-d can only be used when the kernel debugger is enabled
-g ignores initial breakpoint in debuggee
-G ignores final breakpoint at process termination
-hd specifies that the debug heap should not be used
for created processes. This only works on Windows Whistler.
-o debugs all processes launched by debuggee
-p pid specifies the decimal process Id to attach to
-pd specifies that the debugger should automatically detach
-pe specifies that any attach should be to an existing debug port
-pn name specifies the name of the process to attach to
-pt # specifies the interrupt timeout
-pv specifies that any attach should be noninvasive
-r specifies the (0-3) error level to break on (SeeSetErrorLevel)
-robp allows breakpoints to be set in read-only memory
-t specifies the (0-3) error level to display (SeeSetErrorLevel)
-w specifies to debug 16 bit applications in a separate VDM
-x sets second-chance break on AV exceptions
-x{e|d|n|i} <event> sets the break status for the specified event
-2 creates a separate console window for debuggee
-i ImagePath specifies the location of the executables that generated
the fault (see _NT_EXECUTABLE_IMAGE_PATH)
-lines requests that line number information be used if present
-myob ignores version mismatches in DBGHELP.DLL
-n enables verbose output from symbol handler
-noio disables all I/O for dedicated remoting servers
-noshell disables the .shell (!!) command
-QR <\\machine> queries for remote servers
-s disables lazy symbol loading
-ses enables strict symbol loading
-sfce fails critical errors encountered during file searching
-sicv ignores the CV record when symbol loading
-snul disables automatic symbol loading for unqualified names
-srcpath <SourcePath> specifies the source search path
-v enables verbose output from debugger
-wake <pid> wakes up a sleeping debugger and exits
-y <SymbolsPath> specifies the symbol search path (see _NT_SYMBOL_PATH)
-z <CrashDmpFile> specifies the name of a crash dump file to debug
-zp <CrashPageFile> specifies the name of a page.dmp file
to use with a crash dump
-remote lets you connect to a debugger session started with -server
must be the first argument if present
transport: tcp | npipe | ssl | spipe | 1394 | com
name: machine name on which the debug server was created
portid: id of the port the debugger server was created on
for tcp use: port=<socket port #>
for npipe use: pipe=<name of pipe>
for 1394 use: channel=<channel #>
for com use: port=<COM port>,baud=<baud rate>,
channel=<channel #>
for ssl and spipe see the documentation
example: ... -remote npipe:server=yourmachine,pipe=foobar
-server creates a debugger session other people can connect to
must be the first argument if present
transport: tcp | npipe | ssl | spipe | 1394 | com
portid: id of the port remote users can connect to
for tcp use: port=<socket port #>
for npipe use: pipe=<name of pipe>
for 1394 use: channel=<channel #>
for com use: port=<COM port>,baud=<baud rate>,
channel=<channel #>
for ssl and spipe see the documentation
example: ... -server npipe:pipe=foobar
-premote transport specifies the process server to connect to
transport arguments are given as with remoting
Environment Variables:
_NT_SYMBOL_PATH=[Drive:][Path]
Specify symbol image path.
_NT_ALT_SYMBOL_PATH=[Drive:][Path]
Specify an alternate symbol image path.
_NT_DEBUGGER_EXTENSION_PATH=[Drive:][Path]
Specify a path which should be searched first for extensions dlls
_NT_EXECUTABLE_IMAGE_PATH=[Drive:][Path]
Specify executable image path.
_NT_SOURCE_PATH=[Drive:][Path]
Specify source file path.
_NT_DEBUG_LOG_FILE_OPEN=filename
If specified, all output will be written to this file from offset 0.
_NT_DEBUG_LOG_FILE_APPEND=filename
If specified, all output will be APPENDed to this file.
_NT_DEBUG_HISTORY_SIZE=size
Specifies the size of a server's output history in kilobytes
Control Keys:
<Ctrl-B><Enter> Quit debugger
<Ctrl-C> Break into Target
<Ctrl-F><Enter> Force a break into debuggee (same as Ctrl-C)
<Ctrl-P><Enter> Debug Current debugger
<Ctrl-V><Enter> Toggle Verbose mode
<Ctrl-W><Enter> Print version information
ntsd: exiting - press enter --- |
|
全英文呵呵。。等高手来解密。
我只知道大概用法。。。
ntsd -c q -p PID 这命令可结束除System、SMSS.EXE和CSRSS.EXE以外所有进程。。
作者: HAT
时间: 2007-6-27 10:39
//ntsd -c q -pn explorer.exe 啥意思?? 出现个黑框框 然后很多东西一闪就过??
-c 用来执行后面跟的debug命令(后面的q就是用来退出的啦)
-pn 用来指定要杀死哪个进程
Quote: |
ntsd命令简介
只有System、SMSS.EXE和CSRSS.EXE不能杀。前两个是纯内核态的,最后那个是Win32子系统,ntsd本身需要它。
ntsd从2000开始就是系统自带的用户态调试工具。被调试器附着(attach)的进程会随调试器一起退出,所以可以用来在命令行下终止进程。使用ntsd自动就获得了debug权限,从而能杀掉大部分的进程。
ntsd会新开一个调试窗口,本来在纯命令行下无法控制,但如果只是简单的命令,比如退出(q),用-c参数从命令行传递就行了。
ntsd按照惯例也向软件开发人员提供。只有系统开发人员使用此命令。有关详细信息,请参阅 NTSD 中所附的帮助文件。 |
|
作者: terse
时间: 2007-6-27 12:50
补充一点 -P和-PN作用相同 -pn 后面是你要结束的进程名称‘注意的是后缀名.exe是不可省略的,否则系统会告诉你:不支持此接口, -p 后面是你要结束的进程对应的PID