Set file attribute of external file

tranchemontaigne

Registered User.
Local time
Today, 14:15
Joined
Aug 12, 2008
Messages
203
I have a database that extracts a batch file and then executes this file as part of an OnExit procedure

What I want to do is set the file attribute of this extracted batch file to be hidden.

My code looks like this:

strFileAndPath = CurrentProject.Path & "\ClearTempFiles.bat"
'This code works great!
Call fnExtractBLOB(100, "t02_Inventory", strFileAndPath)
Call Shell(strFileAndPath)

'Attempts to set the file attribute of ClearTempFiles.bat to hidden
strFileAndPath = "C:\WINDOWS\system32\cmd.exe ATTRIB +H " & strFileAndPath
Call Shell(strFileAndPath)

'closes the database
CloseCurrentDatabase

When I run this code a command window opens, but the ATTRIB instruction is lost.

Any ideas?


Acknowledgement: Special thanks goes to Leigh Purvis for the excellent sample database on BLOB handling within MS Access (http://www.databasedevelopment.co.uk/examples.htm)
________
Bmw r68
 
Last edited:
Try changing:
Code:
strFileAndPath = "C:\WINDOWS\system32\cmd.exe ATTRIB +H " & strFileAndPath
Call Shell(strFileAndPath)
...to
Code:
SetAttr strFileAndPath, vbHidden
 

Users who are viewing this thread

Back
Top Bottom