Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run .bat file from VB.NET to move files

Status
Not open for further replies.

monkey64

Technical User
Apr 27, 2008
69
GB
I have a .bat file which moves files from one location to another:

Code:
move "W:\imagedump\*.jpg" "C:\test\"

When I manually click the .bat file, it works perfectly. When I get VB.NET to run the process, I get a quick DOS box flash and nothing happens. I'm guessing it is a security issue. This is how I am calling the file:

Code:
Dim MoveProcess As Process = New Process()

MoveProcess.StartInfo.FileName = "C:\ImageUpload\move.bat"
MoveProcess.Start()
MoveProcess.WaitForExit()

Have also tried this:

Code:
Shell("C:\ImageUpload\move.bat", AppWinStyle.NormalFocus)

In both cases the files do not get moved. Any ideas?
 
Within minutes of posting this, the answer came to me!

It's all to do with permissions for the file itself.
Right click the file, then Properties > Security > Authenticated Users > Edit. Click Full Control. Job done.

Hope it helps someone else in the future.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top