Tech Support Forum banner

Windows 7 .bat file problem

3994 Views 1 Reply 1 Participant Last post by  jacobwake
Apologies if this is posted in the wrong area, I couldn't find a specific area for scripting issues and as its using the windows 7 diskpart cmd I thought it could go here.

I am trying to automate the process of formatting a hard drive with Diskpart:

select disk 1
create partition primary
format fs=ntfs label="CCTV" quick

I have searched the internet and understood that i should create a .txt file with that code, then create a .bat file of:

DISKPART /s c:\file location\script.txt

However whenever i run the .bat file i just get a cmd window displaying the text of my .bat file

When i go into diskpart and call the script manually i get:

diskpart was unable to open or read the script file.
make sure the file you specified exists.

It goes without saying i am running everything with administrator privileges. I am new to .bat files etc so am in completely untested water for me.

If anybody knows what i am doing wrong then please come back with suggestions
Not open for further replies.
1 - 2 of 2 Posts
Ah, will have to strike this one down to user error.

It appears the my text file was very handily called "diskpart.txt.txt" thanks to the windows 7 feature of automatically hiding file extensions. Safe to say I've now disabled that and after correcting my spelling mistake it all runs through perfect.

Thanks anyway!
1 - 2 of 2 Posts
Not open for further replies.