如何使用 App.Path

发布于 2024-11-26 16:47:43 字数 721 浏览 1 评论 0原文

好吧,我用 VB6 编写了这些代码,但是当我运行它时,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
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
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
Open App.Path & "\ipreglog.log" For Append As #1
    Print #1, inip
Close #1

谢谢

Well i made these code in VB6 but when i run it , the Vb said me Path not found , can anyone help me, here is my VB 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
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
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
Open App.Path & "\ipreglog.log" For Append As #1
    Print #1, inip
Close #1

Thanks

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

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

发布评论

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

评论(2

非要怀念 2024-12-03 16:47:43

MkDir 不是递归的,因此它需要直接父级存在。
尝试首先确保 Users 目录存在:

MkDir App.Path & "\users\"
MkDir App.Path & "\users\" & Splice(2)

MkDir is not recursive so it requires the immediate parent to exist.
Try ensuring that the Users directory exists first:

MkDir App.Path & "\users\"
MkDir App.Path & "\users\" & Splice(2)
唱一曲作罢 2024-12-03 16:47:43

嗯,可能该路径不存在。您需要进一步调查才能找到确切的问题。

  1. 使用断点(或 MsgBox)暂停代码并准确地告诉您它正在尝试打开哪个路径。
  2. 当您暂停代码时,转到 Windows 资源管理器并检查该路径是否存在。
    一个。检查路径名中是否有空格。
    b.检查所有目录是否存在。 MkDir 一次只创建一个目录,它要求直接父目录存在(正如 Deanna 所说)。

您正在写入 App.Path 下的文件。注意程序虚拟化文件。 Windows 通过秘密写入虚拟文件夹来阻止程序写入 Program Files 及其子目录。

Erm, probably the path does not exist. You need to investigate further to find the exact problem.

  1. Use a breakpoint (or a MsgBox) to pause the code and tell you exactly which path it is trying to open.
  2. While you have the code paused, go to Windows Explorer and check whether the path exists.
    a. Check for spaces in the pathname.
    b. Check that all the directories exist. MkDir only makes one directory at a time, it requires the immediate parent to exist (as Deanna says).

You are writing to files underneath App.Path. Watch out for virtualisation of Program Files. Windows prevents programs from writing to Program Files and its subdirectories by secretly writing to a virtual folder instead.

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