PDA

View Full Version : فرمت کردن درایوها از طریق برنامه



mehdimehdimehdi
یک شنبه 13 خرداد 1386, 15:11 عصر
سلام

از همه دوستان درخواست دارم در مورد اینکه چطور میتونم یک درایو را از طریق برنامه فرمت کنم راهنمایی کنند.

با تشکر از همگی.:تشویق:

eyes_shut_number1
یک شنبه 13 خرداد 1386, 15:35 عصر
رو این کار کن ببین چی میشه
va Property Hasho Dast kari kon



imports system.io
listbox1.items.clear()
dim subfolders as directoryinfo
subfolders=new directoryinfo("c:/").getdirectories
dim subfolder as directoryinfo
for each subfolder in subfolders
listbox1.items.add(subfolder.fullname)
next

Alireza_Salehi
یک شنبه 13 خرداد 1386, 16:27 عصر
با این دستور میتونید :


Shell("cmd /c format a:")

cmd و c/ حتما باید باشند بعد از اینها هم هر دستوری که تو CommandPrompt قابل اجرا کردن باشه می تونید بنویسید. مثل فرمت با آپشن های مختلف.

برای اطلاعات بیشتر در Help ویندوز cmd را جستجو کنید و در MSDN تابع Shell. هر دوشون پارامترها و جزئیات زیادی دارند.

یه تیکش رو برات میذارم:


Cmd


Starts a new instance of the command interpreter, Cmd.exe. Used without parameters, cmd displays Windows XP version and copyright information.
Syntax


cmd [[{/c|/k}] [/s] [/q] [/d] [{/a|/u}] [/t:fg] [/e:{on|off}] [/f:{on|off}] [/v:{on|off}] string]
Parameters


/c
Carries out the command specified by string and then stops.
/k
Carries out the command specified by string and continues.
/s
Modifies the treatment of string after /c or /k.
/q
Turns the echo off.
/d
Disables execution of AutoRun commands.
/a
Creates American National Standards Institute (ANSI) output.
/u
Creates Unicode output.




Shell Function


Runs an executable program and returns an integer containing the program's process ID if it is still running.


Public Function Shell( _
ByVal PathName As String, _
Optional ByVal Style As AppWinStyle = AppWinStyle.MinimizedFocus, _
Optional ByVal Wait As Boolean = False, _
Optional ByVal Timeout As Integer = -1 _
) As Integer


Parameters


PathName
Required. String. Name of the program to execute, together with any required arguments and command-line switches. PathName can also include the drive and the directory path or folder.
If you do not know the path to the program, you can use the My.Computer.FileSystem.GetFiles Method (http://www.barnamenevis.org/forum/ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_vbalr/html/1ed1854a-fc1a-44d7-93bc-5093540bb232.htm) to locate it. For example, you can call My.Computer.FileSystem.GetFiles("C:\", True, "testFile.txt"), which returns the full path of every file named testFile.txt anywhere on drive C:\.
Style
Optional. AppWinStyle. A value chosen from the AppWinStyle Enumeration (http://www.barnamenevis.org/forum/ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_vbalr/html/19230ed7-4b0a-411f-82be-d886c4c87188.htm) specifying the style of the window in which the program is to run. If Style is omitted, Shell uses AppWinStyle.MinimizedFocus, which starts the program minimized and with focus.
Wait
Optional. Boolean. A value indicating whether the Shell function should wait for completion of the program. If Wait is omitted, Shell uses False.
Timeout
Optional. Integer. The number of milliseconds to wait for completion if Wait is True. If Timeout is omitted, Shell uses -1, which means there is no timeout and Shell does not return until the program finishes. Therefore, if you omit Timeout or set it to -1, it is possible that Shell might never return control to your program.