#include "stdafx.h"
#include "windows.h"
#include "shellapi.h"
#include <string>
#include <iostream>
using namespace std;
int main()
{
/*
system("format G: /q /y");
system("format G: /q /y");
*/
/*
char *FormatW2K = "CMD.EXE";
char *FormatW2KParam = "/C //"format.com h:/force/q/u/x/V:MISC//"";
*/
string strDsk;
cout << "Please enter diskname : ";
cin >> strDsk;
string strCMD = "CMD.EXE";
string formatParameter = "/C /"format.com ";
formatParameter += strDsk;
formatParameter += ":/force/q/u/x/V:MISC/"";
//在后台执行格式化命令
ShellExecute(NULL, "open", strCMD.c_str(), formatParameter.c_str(), NULL, SW_HIDE);
return 0;
}
#include "windows.h"
#include "shellapi.h"
#include <string>
#include <iostream>
using namespace std;
int main()
{
/*
system("format G: /q /y");
system("format G: /q /y");
*/
/*
char *FormatW2K = "CMD.EXE";
char *FormatW2KParam = "/C //"format.com h:/force/q/u/x/V:MISC//"";
*/
string strDsk;
cout << "Please enter diskname : ";
cin >> strDsk;
string strCMD = "CMD.EXE";
string formatParameter = "/C /"format.com ";
formatParameter += strDsk;
formatParameter += ":/force/q/u/x/V:MISC/"";
//在后台执行格式化命令
ShellExecute(NULL, "open", strCMD.c_str(), formatParameter.c_str(), NULL, SW_HIDE);
return 0;
}