我正在处理一个批处理文件。
它需要调用VBS和REG,所以我使用%-dp0变量来获取文件夹路径。但是,它似乎给了我相当于system32路径。
这里有什么问题,有没有等价物?
这是我的代码:
cd %-dp0
cscript.exe VBS.vbs
cscript.exe VBS2.vbs
goto :eof
和
cd %-dp0
regedit.exe Regedit.reg
goto :eof
它返回如下内容:
找不到C:\ WINDOWS \ system32 \ VBS.vbs
答案 0 :(得分:4)
我认为你的剧本中存在拼写错误
您应该使用代字号 // Open the Excel file.
Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(Path.GetFullPath(@"C:\Users\user\Documents\Book2.xlsx"));
// Get the first worksheet.
Excel.Worksheet xlWorksheet = (Excel.Worksheet)xlWorkbook.Sheets.get_Item(1);
// Get the range of cells which has data.
Excel.Range xlRange = xlWorksheet.UsedRange;
// Get an object array of all of the cells in the worksheet with their values.
object[,] valueArray = (object[,])xlRange.get_Value(
Excel.XlRangeValueDataType.xlRangeValueDefault);
for (int row = 1; row <= xlWorksheet.UsedRange.Rows.Count; ++row)
{
for (int col = 1; col <= xlWorksheet.UsedRange.Columns.Count; ++col)
{
Console.WriteLine(valueArray[row, col].ToString());
}
int y = xlWorksheet.UsedRange.Rows.Count / 4;
for() {
Console.WriteLine("4 addresat e para u printuan");
Console.WriteLine(" ");
}
}
%-dp0
而不是 %~dp0
你的脚本就像这样:
cd %~dp0
cscript.exe VBS.vbs
cscript.exe VBS2.vbs
goto :eof