Convert Vbnormal and Vbreadonly vba codes to MS DOS commands

Asatoma Sadgamaya
Asatoma Sadgamaya used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
IT / Software Engineering Consultant
Top Expert 2016
Commented:
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

Author

Commented:
Hi Bill,

@echo off
attrib -r +a +s -h "C:\aa\bb.xlsx"
attrib -r +a +s -h "C:\Report.xlsx"

Author

Commented:
Thank you Bill
Bill PrewIT / Software Engineering Consultant
Top Expert 2016

Commented:
Welcome, glad that helped.


»bp

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial