如何在App.Path中访问?

发布于 2024-11-27 02:42:29 字数 868 浏览 1 评论 0原文

当我在 VB 中运行此代码时,VB 告诉我“补丁文件访问错误”。有人可以帮助我吗?这是我的代码:

MkDir App.Path & "\users\" & Splice(2)
Open App.Path & "\users\" & Splice(2) & "\pass.txt" For Append As #1
Print #1, Splice(3)
Close #1
MkDir App.Path & "\users\" & Splice(2)
Open App.Path & "\users\" & Splice(2) & "\list.txt" For Append As #1
Print #1, "" 'we have to put something into the buddy list
                 'so well put nothing ;)
Close #1
MkDir App.Path & "\users\" & Splice(2)
Open App.Path & "\users\" & Splice(2) & "\info.txt" For Append As #1
Print #1, "" 'we have to put something into the buddy list
                 'so well put nothing ;)
Close #1
MkDir App.Path & "\users\" & Splice(2)
Open App.Path & "\users\" & Splice(2) & "\ipreglog.log" For Append As #1
Print #1, inip
Close #1

When I run this code in VB, the VB said me "Patch file access error". Can anybody help me? Here is my code:

MkDir App.Path & "\users\" & Splice(2)
Open App.Path & "\users\" & Splice(2) & "\pass.txt" For Append As #1
Print #1, Splice(3)
Close #1
MkDir App.Path & "\users\" & Splice(2)
Open App.Path & "\users\" & Splice(2) & "\list.txt" For Append As #1
Print #1, "" 'we have to put something into the buddy list
                 'so well put nothing ;)
Close #1
MkDir App.Path & "\users\" & Splice(2)
Open App.Path & "\users\" & Splice(2) & "\info.txt" For Append As #1
Print #1, "" 'we have to put something into the buddy list
                 'so well put nothing ;)
Close #1
MkDir App.Path & "\users\" & Splice(2)
Open App.Path & "\users\" & Splice(2) & "\ipreglog.log" For Append As #1
Print #1, inip
Close #1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

挽清梦 2024-12-04 02:42:30

我建议您的进程没有创建目录的路径所需的权限?默认情况下,用户对 c:\Users 具有修改权限

。如果您未使用以管理员身份运行提升进程,您可能会在 Windows 7 上遇到此问题。对于 VB6 IDE 来说确实如此,并且默认情况下不会以管理员身份运行。

I would suggest that your process doesn't have the necessary permissions on the path to create a directory? By default Users do have modify privileges on c:\Users

You can get this issue on Windows 7 if you haven't elevated your process using Run As Administrator. This is true for the VB6 IDE as well as this doesn't run as admin by default.

一抹微笑 2024-12-04 02:42:30

如果您尝试创建 (MkDir) 已存在的目录,您将收到错误 75,路径/文件访问错误。您需要修改代码来检查该目录,并仅在该目录不存在时才创建它。

If Len(Dir(App.Path & "\users" & Splice(2)) = 0 Then
    MkDir App.Path & "\users" & Splice(2)
End If

ETC。

If you try to create (MkDir) a directory that already exists you will get an error 75, Path/File access error. You need to modify your code to check for the directory and create it only if it does not exist.

If Len(Dir(App.Path & "\users" & Splice(2)) = 0 Then
    MkDir App.Path & "\users" & Splice(2)
End If

etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文