Click here to Skip to main content
15,887,436 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Copy .exe file to desktop Pin
Richard MacCutchan29-Nov-15 22:26
mveRichard MacCutchan29-Nov-15 22:26 
AnswerRe: Copy .exe file to desktop Pin
Dave Kreskowiak30-Nov-15 5:12
mveDave Kreskowiak30-Nov-15 5:12 
GeneralRe: Copy .exe file to desktop Pin
Mycroft Holmes30-Nov-15 12:09
professionalMycroft Holmes30-Nov-15 12:09 
GeneralRe: Copy .exe file to desktop Pin
Dave Kreskowiak30-Nov-15 14:43
mveDave Kreskowiak30-Nov-15 14:43 
GeneralRe: Copy .exe file to desktop Pin
dell-gl62m30-Nov-15 16:52
dell-gl62m30-Nov-15 16:52 
GeneralRe: Copy .exe file to desktop Pin
Dave Kreskowiak30-Nov-15 16:54
mveDave Kreskowiak30-Nov-15 16:54 
GeneralRe: Copy .exe file to desktop Pin
dell-gl62m30-Nov-15 17:13
dell-gl62m30-Nov-15 17:13 
GeneralRe: Copy .exe file to desktop Pin
Dave Kreskowiak30-Nov-15 17:58
mveDave Kreskowiak30-Nov-15 17:58 
OK, that makes a bit more sense.

But, C:\Temp is not writable by everyone and not everyone will be able to create the folder unless your corporate powers-that-be have allowed that to happen.

A better alternative is C:\Users\userName\App Data\Local\Temp. This folder always exists and the user can write to it by default. The path to the Local folder can be had by calling Environment.GetFolderPath(SpecialFolder.LocalApplicationData). After that, you can append the Temp folder to the path using Path.Combine().

WARNING. Code running from a non-local source, i.e. a network share, runs in a VERY restricted sandbox and may not be able to do what you want.

On top of that, the .EXE file is LOCKED when it's running. You cannot open it to make a copy while the code is running and you cannot overwrite the .EXE if you're running the local copy of the .EXE and looking to update it from the network source.

The real question is WHY you want to do this? It serves no real purpose.
A guide to posting questions on CodeProject

Click this: Asking questions is a skill.
Seriously, do it.

Dave Kreskowiak

GeneralRe: Copy .exe file to desktop Pin
dell-gl62m30-Nov-15 18:37
dell-gl62m30-Nov-15 18:37 
GeneralRe: Copy .exe file to desktop Pin
Richard Deeming30-Nov-15 23:17
mveRichard Deeming30-Nov-15 23:17 
GeneralRe: Copy .exe file to desktop Pin
Dave Kreskowiak1-Dec-15 1:33
mveDave Kreskowiak1-Dec-15 1:33 
AnswerRe: Copy .exe file to desktop Pin
Amarnath S1-Dec-15 2:45
professionalAmarnath S1-Dec-15 2:45 
GeneralRe: Copy .exe file to desktop Pin
Dave Kreskowiak1-Dec-15 4:01
mveDave Kreskowiak1-Dec-15 4:01 
QuestionWhile return CMDIChildWndEx::DestroyWindow(); taking time Pin
Member 1189107024-Nov-15 18:25
Member 1189107024-Nov-15 18:25 
QuestionRe: While return CMDIChildWndEx::DestroyWindow(); taking time Pin
Richard MacCutchan24-Nov-15 21:56
mveRichard MacCutchan24-Nov-15 21:56 
QuestionD A Pin
JR21216-Nov-15 1:37
JR21216-Nov-15 1:37 
AnswerRe: D A Pin
Dave Kreskowiak16-Nov-15 8:13
mveDave Kreskowiak16-Nov-15 8:13 
GeneralRe: D A Pin
JR21216-Nov-15 20:47
JR21216-Nov-15 20:47 
Questionlogon script with .vbs format to open a picture file. Pin
Member 1214145115-Nov-15 11:51
Member 1214145115-Nov-15 11:51 
AnswerRe: logon script with .vbs format to open a picture file. Pin
Richard MacCutchan15-Nov-15 21:06
mveRichard MacCutchan15-Nov-15 21:06 
QuestionVB.NET library for Excel Pin
BobbyStrain14-Nov-15 14:42
BobbyStrain14-Nov-15 14:42 
AnswerRe: VB.NET library for Excel Pin
CHill6012-Dec-15 4:17
mveCHill6012-Dec-15 4:17 
QuestionShopping cart Pin
Member 1213890914-Nov-15 5:53
Member 1213890914-Nov-15 5:53 
AnswerRe: Shopping cart Pin
Wombaticus14-Nov-15 7:02
Wombaticus14-Nov-15 7:02 
AnswerRe: Shopping cart Pin
Richard Andrew x6414-Nov-15 7:40
professionalRichard Andrew x6414-Nov-15 7:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.