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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -