I'm getting an annoying error like:
The process cannot access the file 'C:\Program Files (x86)\AceHc\trfpt.exe' because it is being used by another process.
The error happens when I try to use Process.Start after File.Copy the same file.
Code:
File.Copy(PathFrom & "\trfpt.exe", PathTo & "\trfpt.exe", True)
Process.Start(PathTo & "\trfpt.exe")
What am I doing wrong?
Do you have a virus scanner that might be scanning the file directly after the copy and blocking it?
It might be worth trying to temporarily disable it and see if the problem goes away.
Also, depending in the size of the file, maybe the EXE file is still being copied (that is, the copy function doesn't block que program flow, your code continue and the copy process continue in background).
Download Handle from Windows Sysinternals and run it as admin from cmd to get a list of processes which hold a handle on that file:
handle.exe trfpt.exe
A wild guess - do you have a Windows Explorer window open looking at the folder 'Pathto' ?
Related
I just installed nvim for the first time, this is also my first time using a terminal based code editor, and I'm migrating from VSCode (ik it's going to be hard),
and now I'm configuring it, I'm following this tutorial:
https://www.youtube.com/watch?v=vdn_pKJUda8&t=347s&ab_channel=JoseanMartinez
And when put the code in the options.lua file, it does not do anything, for example, the
opt.relativenumber = true
is not doing anything
I have tried running commands to change settings, and that has worked, for example
:set relativenumber
But as soon as I exit the file and open a new one, it just breaks again
I have tried simply copy and pasting the code, restarting nvim, switching terminal emulators, etc.
It's really annoying because I am trying to get rid of this stupid feature where it continues comments to the next line and I have to run like 50 commands every time I open a new file just so I can edit it the way I want
My .config file is in
C:\Users\brady\.config
and my nvim.exe file is in
C:\Users\brady\nvim-win64\bin
I am on Windows 10 and my terminal emulator is called 'Tabby'
I figured it out! All the tutorials I am watching are on Linux, but I am on Windows. So instead of putting the nvim folder in my .config, I am supposed to put it in C:\Users\brady\AppData\Local
Are you sure that you're adding your nvim-config file in the correct directory? I'd assume that you need to add your init.vim into C:\Users\brady\.config\nvim\init.vim.
Maybe this answer helps you.
I was deleting an Access Object (a report) and Access crashed during the delete.
The object no longer exists in Access, but its module still shows up in VBA like a ghost.
If I click on it, I get a FILE NOT FOUND error.
If I try to compact & repair or compile the database, I get a FILE NOT FOUND error.
How can I solve this problem?
A potential option is to create a new database file, and import all of the content from the old database file. that will clear out the funky ghost stuff.
you write you tried compile already and it did not work.
Did you try decompile first though?
First of all make a backup copy (but am sure you already did that :) )
With Access and your access file closed type from the command prompt:
C:\yourOfficeInstallPath\MSACCESS.EXE /decompile
Access will start. Click File > Open and select the database you want to decompile
Open any module and click Debug > Compile
Then save your file and close.
Open again your file and compact it.
Let me know if it solved it.
I create a .txt file in C++ in the application folder /Common/Send/Test.txt
Than I call a VB.net application from the c++ code
the Vb.net app read the test.txt content than send it to a Web-Server with POST request, than delete the file.
But its not delete the file, the VB.net app crashing when it need to delete the file.
My.Computer.FileSystem.DeleteFile(".\\Common\Send\Test.txt")
I am using this to delete the file, what can be the problem?
The problem is its write another program using this file, thats why it cannot delete, how can I stop my application 1st part? Because I read the file, but than its doesnt close it. I think thats the problem.
I would use something like this to delete the file ...
Try
System.IO.File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\Common\Send\Test.txt")
Catch ex As Exception
'it may not exist so no worries ...
End Try
To address the issue of it being open in a different process, here are your options:
http://www.codeproject.com/Questions/661082/Delete-a-file-that-is-in-use-by-another-process-wi
I really don't know what is going on. I used this code a lot of times, but for my current project I can't copy anything to clipboard without Catch ex As Exception which I don't like it cause it take so long until the content is copied to clipboard.
Does anyone know why I get this error?
You need to run your application as Administrator or open your Visual Studio IDE with option Run as administrator.
Don't forget to tell the type of data format you want to copy into Clipboard, after changing the text.
Clipboard.SetText("df", TextDataFormat.Text)
Is there any way to determine if a text file is currently open in a text editor? Or better yet, is there a way to trigger an event when a text file is opened (from any program)?
Using the FileSystemWatcher component you can detect Changed, Created, Deleted, and Renamed events statically.
If you want to detect Last Access you need to manually set the NotifyFilter to include LastAccess.
When most editors have a file open they typically follow a set strategy:
1. Open File
2.Read entire contents into buffer
3.Close File
Then your program runs. Since the file is already closed, any attempts to open it will of course succeed. Using a FileSystemWatcher this can be detected if a file is open or closed. However, you will not be able to detect if the file has been open prior to your program running.
I think I'll make a Timer that checks the last modified time of the file.... and when the program starts, it'll get the last modified time.