WPF Vb.net Copyto not working? -
i tyring fire event copies program startup folder. not understand going wrong? keep on getting exception message. file being copies not in use.
try dim desktoplink string = environment.getfolderpath(environment.specialfolder.desktop) dim startupfolder string = environment.getfolderpath(environment.specialfolder.startup) dim info new fileinfo(startupfolder) info.copyto(desktoplink + "\doessomething.bat") catch ex exception messagebox.show("error: can not copy startup folder") end try
right now, you're creating fileinfo
folder, not file.
this should be:
dim info new fileinfo(path.combine(startupfolder, "doessomething.bat")) info.copyto(path.combine(desktoplink, "doessomething.bat"))
or, easier:
dim source = path.combine(startupfolder, "doessomething.bat") dim target = path.combine(desktoplink, "doessomething.bat") file.copy(source, target)
Comments
Post a Comment