Does anybody know how it can be done?
I have a good way to do it using windows dialog box.
I just want to press a button and the a: formats, no forms, no questions.
Possible?
Thanks
Wengang
Printable View
Does anybody know how it can be done?
I have a good way to do it using windows dialog box.
I just want to press a button and the a: formats, no forms, no questions.
Possible?
Thanks
Wengang
yes it is possible!
I hesitate to post the code though because it could be used on the hard-drive as well!
A simple DOS command would do it :rolleyes:.
Code:Shell "Command.com Format A:", vbHide
'or is it:
'Shell "Format A:", vbHide ?
Did you try either of those Matthew?
You'll find they don't work
Like I say is is possible but, well, my reason stated before still applies!
Your reason=DANGEROUS?
I've formatted a floppy disk manually before, never through VB. And I have never formatted my hard drive simply because..I'm scared to. I found out that you need a disk or something in order to restore Windows, but I don't have it, so I can't format my computer at all.
Sorry for the misunderstanding. The floor...is all yours, Mark :rolleyes:.
my reason is that anyone reading a posting could write an exe which could format your hardrive without you wanting it to!
Having said that it's trivial anyway and took me about 10 seconds to work out how to get around the fact that format wants you to press a key before continuing
Though I might make some enemies right now, I think the solution is this:
The /autotest parameter specifies explicitly you don't want any questions... You could also add a /Q for Quick format and a /U for not saving Undo data.Code:Shell "command.com Format A: /autotest", vbHide
' or
Shell "Format A: /autotest", vbHide
Don't try this at home kids! Also, I couldn't test it b'cause I'm running Win2000 Pro, wich doesn't support the /autotest paramater anymore....
Hope I helped... Don't use it for any mean thing though....
Enjoy!
P.s. I usually make sure I have a backup of all my important files and sources... Everyone should do that!
that doesn't work either RobIII
not on my NT4 pc anyway
My (secret) method works a treat though! :)
Well, you could always KILL al files... ???
I fail to see why no dialog would be needed?
If you are formatting a drive you certainly want to be there unless of course it's a backdoor format. As for a floppy...can you even buy an unformatted floopy anymore? And even at best, wanting to reformat an old floppy, you would need to be there to insert/remove the floppy anyway so who cares about a dialog box that is in place to help you out.
Mark Sreeves,
I was wondering if there was such a func in VB for a long time. The only way I know how to do it (in an hard drive) doesn't let me format it if there is a doc open on it.
Could you post here your func ?
P.S. - There are a lot of more dangerous funcs posted in this bb.
OK, my method was actually writing a batch file on the fly and shelling out to it.
I haven't actually tried it on my hard drive though :)
I just assumed it would work!
Maybe I'm being over cautious.
format requires a key press to continue so all I do is feed a file containing a carrage-return back into it
Code:Option Explicit
Private Sub Command1_Click()
Dim fnum As Byte
Dim TempFile As String
fnum = FreeFile
TempFile = "C:\~~cr~~.tmp"
Open TempFile For Output As fnum
Print #fnum, vbCr
Close fnum
fnum = FreeFile
TempFile = "C:\~vb~tmp~.bat"
Open TempFile For Output As fnum
Print #fnum, "format a: < c:\~~cr~~.tmp"
Close fnum
Shell TempFile, vbHide
End Sub
How about this then?
The Echo command would send a "Y" and Enter to any question asked...Code:Shell "Command.com Echo Y| Format A:", vbHide
Enjoy!
Hey all.
Mark, Rob, you guys really helped me out on that one. Anyway, since I started this thread, the whole idea was just to find a way to format a stack of floppies one after another as quickly as possible. Thanks to a combination of your codes, I can run one every 10 seconds now.
Matthew, I can see what you mean, but the only people who ever use my software are friends and family. Even at Halloween, i wouldn't trick them into formatting their hard drives.
Thanks again, everybody.
I realise this thread is fprobab;ly finished with now but,
Shell "Command.com Echo Y| Format A:", vbHide
didn't work for me!
Mark,
your method does work great. But I have a couple of questions.
First, the bat leaves something running each time the app is opened. The name is "winoldap". You can see that in the End Task window after you run the app. Then a whole string of them are running if I open and close the app a few times. Is there a way to either limit this to one, close it when the app closes, or automatically end task it within the application?
Second, I found that this is doing a quick format. Is it possible to do a normal format?
Thanks
Wengang
Here's a search on the topic
http://forums.vb-world.net/search.ph...aily=&pagenum=
Kedaman thanks for the link. But it still doesn't answer how to do the full format without showing the windows format dialog each time.
Does anybody have this one figured out?
Thanks