public Form1()
{
InitializeComponent();
this.StartPosition = FormStartPosition.CenterScreen;
}
private void button1_Click(object sender, EventArgs e)
{
Excel.Application excelApp = new Excel.Application();
Excel.Workbooks excelBooks = excelApp.Workbooks;
Excel.Workbook excelBook = excelBooks.Add();
Excel.Worksheet sheet = excelApp.Worksheets["sheet1"];
try
{
Console.WriteLine("開始...");
int i = 1;
string strInput = textBox1.Text;
string path = strInput;
if (strInput == "")
{
MessageBox.Show("フォルダパスを入力してください","確認");
}
else
{
string[] dirs = Directory.GetDirectories(path);
foreach (string s in dirs)
{
Console.WriteLine(s);
listBox1.Items.Add(s);
string repstr = s.Replace("C:", "D:");
excelApp.Visible = true;
sheet.Cells[i, 1] = repstr;
sheet.Cells[i, 2] = "=HYPERLINK(A" + i + ")";
i++;
}
Console.WriteLine("完了");
}
}
catch
{
throw;
}
finally
{
}
}
private void button2_Click(object sender, EventArgs e)
{
Excel.Application excelApp = new Excel.Application();
Excel.Workbooks excelBooks = excelApp.Workbooks;
Excel.Workbook excelBook = excelBooks.Add();
Excel.Worksheet sheet = excelApp.Worksheets["sheet1"];
Console.WriteLine("開始...");
int i = 1;
string strInput = textBox1.Text;
string path = strInput;
string[] dirs = Directory.GetDirectories(path);
foreach (string s in dirs)
{
Console.WriteLine(s);
listBox1.Items.Add(s);
excelApp.Visible = true;
sheet.Cells[i, 1] = s;
sheet.Cells[i, 2] = "=HYPERLINK(A" + i + ")";
i++;
}
string[] files = Directory.GetFiles(strInput, "*");
Console.WriteLine(files.Length);
foreach (string str in files)
{
Console.WriteLine(str);
excelApp.Visible = true;
sheet.Cells[i, 1] = str;
sheet.Cells[i, 2] = "=HYPERLINK(A" + i + ")";
i++;
}
Console.WriteLine("完了");
}
private void button3_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
}
private void button4_Click(object sender, EventArgs e)
{
ProcessStartInfo psInfo = new ProcessStartInfo();
psInfo.FileName = @"C:\wifi\echoSSID.bat";
psInfo.CreateNoWindow = false;
psInfo.UseShellExecute = false;
Process.Start(psInfo);
var ssidList = new List<string>()
{
@"C:\wifi\hello.bat",
@"C:\wifi\echoSSID.bat"
};
foreach (var ssid in ssidList)
{
Console.WriteLine(ssid);
}
}
@echo off
netsh wlan show profiles
set /p ssidname="SSIDを入力してください :"
echo SSID:%ssidname%
netsh wlan export profile name=%ssidname% folder=C:\wifi
pause
@echo off
for %%i in (aaa,bbb,ccc,ddd) do (
echo %%i
netsh wlan add profile filename=%%i%.xml > nul 2>&1
netsh wlan set profileparameter name=%%i keymaterial=<パスワード> connectionmode=auto > nul 2>&1
)
pause