2021年2月11日星期四

For batch files, how to add a newline character to promptString when using "set"?

I'm creating a simple batch file to auto-set paths for Java. Below is the code I currently have. I want to add a number of newlines after the promptString for "java_path" in line 2 before the input. Help please?

@echo off  set /p java_path=Enter path to Java installation folder, including quotation marks (eg: "C:\Program Files\Java\jdk-15.0.1"):   setx -m JAVA_HOME %java_path%  setx -m PATH "%PATH%;%java_path:"=%\bin";  

Resolved after Compo's comment. My original thought was that with "@echo off" that any "echo"s after that line would not work... obviously I didn't understand the command at all.

@echo off  echo Enter path to Java installation folder, including quotation marks (eg: "C:\Program Files\Java\jdk-15.0.1"):  echo(  set /p java_path=  setx -m JAVA_HOME %java_path%  setx -m PATH "%PATH%;%java_path:"=%\bin";  
https://stackoverflow.com/questions/66164379/for-batch-files-how-to-add-a-newline-character-to-promptstring-when-using-set February 12, 2021 at 07:16AM

没有评论:

发表评论