简体   繁体   English

运行批处理文件时在命令提示符下显示的隐藏命令

[英]hide command displaying in command prompt while running batch file

I created a batch file like given below , but this is not getting hidden in command prompt evev though echo off is used. 我创建了一个如下所示的批处理文件,尽管使用了echo off,但是在命令提示符evev中并没有隐藏该批处理文件。

I doesn't want csv file or any other file to display in command prompt. 我不想在命令提示符下显示csv文件或任何其他文件。 it is also showing warning using password in command prompt is insecure, please help me. 它还在命令提示符中使用密码显示警告不安全,请帮助我。

this batch file when run in command prompt produces W P.xls as output file 在命令提示符下运行时,此批处理文件将产生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   Folder\out.sql"
    java -jar csvtoxls.jar
    del out.sql
    del ws.csv
    rename "W P.xls" "W P"%1".xls"

jar file import java.io.DataInputStream; jar文件导入java.io.DataInputStream; import java.io.FileInputStream; 导入java.io.FileInputStream; import java.io.FileOutputStream; 导入java.io.FileOutputStream; import java.io.IOException; 导入java.io.IOException; import java.util.ArrayList; 导入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) {
   }
 }
}

Add @ sign for commands you want to hide. 为要隐藏的命令添加@符号。

Also add > nul in front of command if you don't want show output. 如果不想显示输出,也可以在命令前面添加> nul。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM