You are not logged in.

#1 19 Dec 2014 22:08

robin28691
New Member
Registered: 19 Dec 2014
Posts: 3

multi format flash disc

Hi, i am trying to write a script which will format more then just one flash disk.
here is the script for one disk but i would like to format more in once.
format f: /fs:FAT32 /v:Something /q

sure i know then i wrote another line with different volume it will be fine. But when i do that. It will force me to push Enter again and i don't want that.

How it should work: I put 4 disc to the HUB and start the *.bat. It will format all of those disc and copy there same folders. I am using Xcopy command.
Any idea how to do it? THX for ur replays.
Robin
And sorry for my misteaks in English... It's not my language.

Offline

#2 20 Dec 2014 12:26

foxidrive
Member
Registered: 04 Apr 2013
Posts: 339

Re: multi format flash disc

This tool may be better if you run it with admin permssions. http://www.ridgecrop.demon.co.uk/fat32format.htm

Offline

#3 20 Dec 2014 13:59

bluesxman
Member
From: UK
Registered: 29 Dec 2006
Posts: 1,129

Re: multi format flash disc

I don't have a flash drive to hand that I'd care to test this on, but maybe you could do something like this?

@echo off

REM list of assigned drive letters (be careful!)
set "drives=f g h i"

REM location to place a temporary answer file
set "answer=%temp%\answer.txt"

REM place a notional "Enter" key press into the answer file
echo:>"%answer%"

REM loop through all drives listed
for %%a in (%drives%) do (
    REM run format command, reading the "Enter" key press back from the answer file
    REM see: http://ss64.com/nt/syntax-redirection.html
    format %%a: /fs:FAT32 /v:Something /q < "%answer%"
)

REM tidy up
del "%answer%" 2>nul

Last edited by bluesxman (30 Dec 2014 15:23)


cmd | *sh | ruby | chef

Offline

#4 20 Dec 2014 22:25

robin28691
New Member
Registered: 19 Dec 2014
Posts: 3

Re: multi format flash disc

Bluesxman: thx it works perfectly... I was thinking about for today. But never works for me. It was just shorter code but it asked for Enter allways... so hoestly i don't know how u did it. I don't understand the code. To be more exact the part with answer but it works. If u be so nice and u'll explain that to me i'll be glad, if not i'll understand it. however really thanks. It save me a lot of time in work. Robin

Offline

#5 23 Dec 2014 12:25

bluesxman
Member
From: UK
Registered: 29 Dec 2006
Posts: 1,129

Re: multi format flash disc

I've edited my post above to add explanatory comments throughout.

Last edited by bluesxman (23 Dec 2014 12:25)


cmd | *sh | ruby | chef

Offline

#6 23 Dec 2014 16:30

foxidrive
Member
Registered: 04 Apr 2013
Posts: 339

Re: multi format flash disc

bluesxman wrote:

I've edited my post above

You set the drives variable but it is not used.  Just sayin'

Last edited by foxidrive (23 Dec 2014 16:31)

Offline

#7 30 Dec 2014 15:22

bluesxman
Member
From: UK
Registered: 29 Dec 2006
Posts: 1,129

Re: multi format flash disc

foxidrive wrote:
bluesxman wrote:

I've edited my post above

You set the drives variable but it is not used.  Just sayin'

Whoops!  Retconned.

Last edited by bluesxman (30 Dec 2014 15:23)


cmd | *sh | ruby | chef

Offline

Board footer

Powered by