Convert Vbnormal and Vbreadonly vba codes to MS DOS commands

Hi

It would be great if you could convert below MS Access VBA scripts to a ms dos commands (so that I can create bat file to do the same job)

Public Sub SetAttribNormal()
SetAttr "X:\Report_New.xlsx", vbNormal
SetAttr "N:\Report_New.xlsx", vbNormal
SetAttr "X:\AA\Projects_New.xlsx", vbNormal
End Sub

Public Sub SetAttribReadOnly()
SetAttr "X:\Report_New.xlsx", vbReadOnly
SetAttr "N:\Report_New.xlsx", vbReadOnly
SetAttr "X:\AA\Projects_New.xlsx", vbReadOnly
End Sub

Thank you
A
Asatoma SadgamayaAnalystAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewIT / Software Engineering ConsultantCommented:
You can use the ATTRIB command to set file attributes.  Here's an approach that sets the read only attribute and clears the other three common ones.

@echo off
attrib +r -a -s -h "X:\Report_New.xlsx"
attrib +r -a -s -h "N:\Report_New.xlsx"
attrib +r -a -s -h "X:\AA\Projects_New.xlsx"

Open in new window


»bp

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Asatoma SadgamayaAnalystAuthor Commented:
Hi Bill,

@echo off
attrib -r +a +s -h "C:\aa\bb.xlsx"
attrib -r +a +s -h "C:\Report.xlsx"
Asatoma SadgamayaAnalystAuthor Commented:
Thank you Bill
Bill PrewIT / Software Engineering ConsultantCommented:
Welcome, glad that helped.


»bp
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.