Compiled with Visual Studio (C#),
I have a question about the release of the Windows EXE executable.
Boot to Task Scheduler as a batch system, but
Due to frequent system fixes, releases are required each time.
However, if you release (overwrite the EXE file) while the system is running,
An overwrite error occurs during startup.
for running EXE
To reflect the latest system refresh from the next run
What should I do?
I have a plan below, but it's not smart, so
There are disadvantages that it takes time to start running.
Do you have any other smart ideas?
Do you have a startup framework?
<Proposal>
1.Create an executable EXE file by copying the main body EXE file at the start of the process (same EXE file)
2. Launch the executable EXE file
3. Release the EXE file (overwrite the EXE file) because the EXE file can be overwritten even if it is running
The direct attack method is Windows Installer.If the file is in use, try to replace it after reboot using Restart Manager.If you don't like rebooting, it's out of the question.
774RRR's proposed ClickOnce has automatic update functionality.However, since ClickOnce assumes interaction on the desktop, booting from the task scheduler may not work properly.Starting as a service is not supported at least.
Other than this, I don't think there is a startup framework available.
Is it necessary to separate the loader program from the main unit?
and so on.Loader programs are easy to understand and may be good to write in scripting languages such as PowerShell.
If you want to keep the system running and replace only the affected programs,
US>Explicitly exit and replace the applicable program with one of the following:
You may want to restart the program.
Also, this is behind-the-scenes, but you can rename the program you are running.
You can rename EXE files while the program is running!
Traditionally, if you can wait until the system reboots, you can use the PendMoves and MoveFile tools in Windows Sysinternals.
You can also create your own tools using the MoveFileEx API that you use in the tool.
If you have a large number of files and you have dependencies or configuration changes, it is recommended that you create an installation package that matches the Windows Installer.
There's a tool like this.WiX Tutorial Japanese translation
@774RR After reading the comments, it seems that VisualStudio can do it easily.
Publish the application in ClickOnce
However, I'm not sure if this information will still be applied, but it may not be suitable for the purpose of the questioner.
Permissions - ClickOnce
"ClickOnce" requires lowering the installation barriers to enable use like web applications distributed from the Internet to an unspecified number of people, and allows installation without administrator privileges.
The ClickOnce application with administrator privileges cannot be run.
~Omitted in the middle~
There is a hack here, and you can start a new process with administrator privileges.
916 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
582 PHP ssh2_scp_send fails to send files as intended
573 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
619 Uncaught (inpromise) Error on Electron: An object could not be cloned
© 2024 OneMinuteCode. All rights reserved.