如何从批处理文件中的变量中选择文件夹

时间:2017-04-06 21:37:05

标签: windows batch-file cmd

我试图从用户输入中选择一个文件夹并检查它是否存在,这是我所得到的:

@ECHO OFF
cd backup
set /p name=Please enter the folder name: 
pause
for /d in ("\%name%\database.txt") do (
echo done
set flag=1
)
if %flag%==0 echo This folder doesnt exist Returning to maintenance menu...
pause

1 个答案:

答案 0 :(得分:-1)

@ECHO OFF
set /p name=C:\:
IF EXIST %name% echo "Folder already exists"
IF NOT EXIST %name% echo "Folder does not exist"
pause 

或者你可以简单

function getSheetSectionData(name){
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(name);
  var sheetData = sheet.getDataRange().getValues();
  
  var data = [];
  
  for (var i = 0; i < sheetData.length; i++){
      var obj = {};
      obj = sheetData[i][0];
      return sheetData[i][0];
  }
      data.push(obj);
}