简体   繁体   English

如何使用RegWrite从ASP处理Windows注册表路径中的空格

[英]How to deal with spaces in a windows registry path from ASP using RegWrite

I have a problem in that from ASP I need to write to a Windows Registry key the path to which contains spaces. 我有一个问题,从ASP,我需要向Windows注册表项写入包含空格的路径。 The WScript.Shell RegRead is happy enough with my key, but RegWrite doesn't like it. WScript.Shell RegRead对我的密钥很满意,但是RegWrite不喜欢它。 I have tested using other (dummy) paths and it really looks like it is the spaces that are causing the problem. 我已经使用其他(虚拟)路径进行了测试,确实看起来是引起问题的空格。

<%
   Dim WSH, disable
   Set WSH = CreateObject("WScript.Shell")
   disable = Request("disable")  ' disable will be 1 or 0
   key = "HKEY_LOCAL_MACHINE\SOFTWARE\Data Access Worldwide\" & _
         "Visual DataFlex\10.0\WebApp Server\Web Applications\" & _
         "DAW.Examples.Order10\Disable"
   WSH.RegWrite key, CInt( disable ), "REG_DWORD" 
%>

Gets: Invalid root in registry key "HKLM\\SOFTWARE\\Data Access Worldwide\\Visual DataFlex\\10.0\\WebApp Server\\Web Applications\\DAW.Examples.Order10\\Disable". 获取: 注册表项“ HKLM \\ SOFTWARE \\ Data Access Worldwide \\ Visual DataFlex \\ 10.0 \\ WebApp Server \\ Web应用程序\\ DAW.Examples.Order10 \\ Disable”中的无效根。

Anybody know what to do to fix the problem? 有人知道该怎么办才能解决问题吗? How to escape the spaces maybe? 也许如何逃脱空间?

I've tried using the "HKLM" abbreviation for "HKEY_LOCAL_MACHINE", extra quotes, tildes and other substitutions for the spaces, but now I'm out of ideas. 我曾尝试使用“ HKLM”缩写“ HKEY_LOCAL_MACHINE”,多余的引号,波浪号和其他替代空格,但现在我已经不明白了。 :-( :-(

TIA TIA

Mike 麦克风

I don't think the problem are spaces, but more probably permissions. 我不认为问题出在空格,但更可能是权限。

If I try your code, it works fine for keys residing in HKEY_CURRENT_USER, but I get the same error as you for keys in HKEY_LOCAL_MACHINE. 如果我尝试使用您的代码,则对于驻留在HKEY_CURRENT_USER中的密钥,它可以正常工作,但是对于HKEY_LOCAL_MACHINE中的密钥,我会收到与您相同的错误。 The actual error however, is ACCESS_DENIED. 但是,实际错误是ACCESS_DENIED。

The easiest way is if you download Process Monitor from Microsoft, where you can see all real-time registry activity for each process along with any errors. 最简单的方法是从Microsoft下载Process Monitor ,在这里您可以查看每个进程的所有实时注册表活动以及任何错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从经典ASP迁移到ASP.NET时如何处理链接重定向? - How to deal with link redirects when migrating from classic ASP to ASP.NET? 使用Windows身份验证从经典ASP连接到SQL Server数据库 - Connect to SQL Server database from classic ASP using windows authentication 如何从Windows 2008 Server上的ASP应用程序发送电子邮件 - How to send email from ASP application on Windows 2008 Server 从物理路径下载ASP mvc 4中的文件 - DownloadFile in ASP mvc 4 from physical path IIS 7 + Windows Server 2008-使用CDO从Classic ASP发送电子邮件 - IIS 7 + Windows Server 2008 - Sending Emails from Classic ASP using CDO 在Windows 8中使用Internet Explorer 10调试ASP - Debugging ASP using Internet Explorer 10 in Windows 8 将数据从ASPX发布到ASP页面时删除了空格,但是在发布到ASPX页面时保留了空格 - Spaces being removed when posting data from ASPX to ASP page, but spaces preserved when posting to ASPX page 如何从Windows 2003 Server ASP进行远程安全的Web呼叫 - How to make remote secured web call from Windows 2003 server ASP 如何使用 CDO.Message 在经典 ASP 中从 Windows Docker Z5DA5ACF461B4EFB7E7ZEC801916 发送 email - How to use CDO.Message to send email in Classic ASP from Windows Docker IIS 2019 如何使用 ASP 过滤从数据库中解析的数据 - How to filter data parsed from database using ASP
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM