我创建了一个类似于下面的批处理文件,但这并没有在命令提示符 evev 中隐藏。
我不想要 csv 文件或任何其他文件以在命令提示符中显示。它还显示使用密码在命令提示中的警告是不安全的,请帮助我。
当在命令提示中运行时,此批处理文件生产 W P.XLS 作为输出文件
@echo off
echo %1
echo SET @bdate := "%1"; > a.sql
copy /b a.sql + bdate.sql out.sql
mysql --user="root" --database="abc" --password="123" < "D:New Folderout.sql"
java -jar csvtoxls.jar
del out.sql
del ws.csv
rename "W P.xls" "W P"%1".xls"
jar文件 导入java.io.io.datainputstream; 导入java.io.io.fileinputstream; 导入java.io.io.fileoutputstream; 导入java.io.ioexception; 导入java.util.arraylist;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
public class csv2 {
@SuppressWarnings("deprecation")
public static void main(String args[]) throws IOException {
ArrayList<ArrayList<String>> allRowAndColData = null;
ArrayList<String> oneRowData = null;
String fName = "C:\New folder\ws.csv";
String currentLine;
FileInputStream fis = new FileInputStream(fName);
DataInputStream myInput = new DataInputStream(fis);
int i = 0;
allRowAndColData = new ArrayList<ArrayList<String>>();
while ((currentLine=myInput.readLine()) != null) {
oneRowData = new ArrayList<String>();
String oneRowArray[] = currentLine.split(";");
for (int j = 0; j < oneRowArray.length; j++) {
oneRowData.add(oneRowArray[j]);
}
allRowAndColData.add(oneRowData);
System.out.println();
i++;
}
try {
HSSFWorkbook workBook = new HSSFWorkbook();
HSSFSheet sheet = workBook.createSheet("sheet1");
for (int i1 = 0; i1 < allRowAndColData.size(); i1++) {
ArrayList<?> ardata = (ArrayList<?>) allRowAndColData.get(i1);
HSSFRow row = sheet.createRow((short) 0 + i1);
for (int k = 0; k < ardata.size(); k++) {
System.out.print(ardata.get(k));
HSSFCell cell = row.createCell((short) k);
cell.setCellValue(ardata.get(k).toString());
}
System.out.println();
}
FileOutputStream fileOutputStream = new FileOutputStream("C:\New folder\W P.xls");
workBook.write(fileOutputStream);
fileOutputStream.close();
} catch (Exception ex) {
}
}
}
添加要隐藏的命令的 @符号。
,如果您不希望显示输出,请在命令前添加> nul。