TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Furkan Karagulle
NA
30
3.2k
C# File Copy Problem V2
Dec 2 2020 9:15 PM
static
void
ExeCopy()
{
if
(!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @
"\Microsoft\Windows\Start Menu\Programs\Startup\securpass.exe"
))
{
File.Copy(Path.GetFileName(Application.ExecutablePath), Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @
"\Microsoft\Windows\Start Menu\Programs\Startup\securpass.exe"
);
}
}
Hi, I'm trying to get a copy of my application to the launch folder.
However, although I did not get an error, my code block does not work and my file is not copied.
I would be happy if you could help.
static
void
ExeCopy()
{
RegistryKey registryKey = Registry.CurrentUser.OpenSubKey
(
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"
,
true
);
registryKey.SetValue(
"test.exe"
, Application.ExecutablePath);
}
I added the above code block to my project. But my problem persists. The code block is error free but doesn't work.
static
void
ExeCopy()
{
String path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
var SourcefilePath = Path.Combine(path, @
"\Microsoft\Windows\Start Menu\Programs\Startup\test.exe"
);
// Handles whether there is a `\` or not.
if
(File.Exists(SourcefilePath))
{
File.Copy(SourcefilePath, DestinationPath)
}
}
I've added the above code block to my project. I get an error in the DestinationPath section. What is DestinationPath?
Reply
Answers (
1
)
C#. Algorithm. Please Help. Thanks.
I have class that should know in which class it's object is created ho