Omnicoder

I am trying to make an attribute editor program. I am currently using the code:

Dim appstring = "cmd.exe \c Attrib +s " & SaveFileDialog1.FileName & " -c"

shell(appstring)

But it will not actually apply the "system attribute that the command should... Does anyone know how todo this




Re: Visual Basic Express Edition Executing batch commands that refrence files with spaces in the name

DMan1

Omnicoder wrote:
I am trying to make an attribute editor program.

Then you should use the .NET System.IO namespace...specifically the FileInfo class and

Public Property Attributes() As System.IO.FileAttributes

Member of: System.IO.FileSystemInfo

Summary:

Gets or sets the System.IO.FileAttributes of the current System.IO.FileSystemInfo.

Return Values:

System.IO.FileAttributes of the current System.IO.FileSystemInfo.






Re: Visual Basic Express Edition Executing batch commands that refrence files with spaces in the name

Tall Dude

Public Class Form1

' This adds the 'system' attribute to the selected file

Private Sub Button1_Click(ByVal sender As System.Object, _

ByVal e As System.EventArgs) Handles Button1.Click

If OpenFileDialog1.ShowDialog = _

Windows.Forms.DialogResult.OK Then

Dim old As System.IO.FileAttributes = _

CType(GetAttr(OpenFileDialog1.FileName), IO.FileAttributes)

SetAttr(OpenFileDialog1.FileName, _

CType(old Or IO.FileAttributes.System, FileAttribute))

End If

End Sub

End Class

' Leave the attrib program to us old timers who used it in the DOS days!