Input 将带有空格的用户输入路径保存到文本文件的批处理文件。(胜利7)

Input 将带有空格的用户输入路径保存到文本文件的批处理文件。(胜利7),input,batch-file,Input,Batch File,首先,我是个编程高手。 我试图创建一个批处理文件,当第一次运行时,它将程序的安装目录作为用户输入(意味着第二次运行时它不应该请求目录)。通过搜索各种脚本,我一直到这里 @echo off Echo ============================================= echo Directory Echo ============================================= setlocal enableextensions enabledel

首先,我是个编程高手。 我试图创建一个批处理文件,当第一次运行时,它将程序的安装目录作为用户输入(意味着第二次运行时它不应该请求目录)。通过搜索各种脚本,我一直到这里

 @echo off
Echo =============================================

echo Directory

Echo =============================================

setlocal enableextensions enabledelayedexpansion

set /p mypath=Please specify install directory; 

Echo %mypath% ----was what you typed

pause

echo start>temp.txt

echo %mypath%>>temp.txt

echo \programfolder\program.exe>>temp.txt

echo -argument -argument>>temp.txt

setlocal enabledelayedexpansion

set FINAL=

for /f %%a in (temp.txt) do (

set FINAL=!FINAL!%%a

)

echo %FINAL%>input.txt

del /q temp.txt

Pause

start "<input.txt"
@echo关闭
回音=============================================
回音目录
回音=============================================
setlocal enableextensions enabledelayedexpansion
set/p mypath=请指定安装目录;
Echo%mypath%----是您键入的内容
暂停
echo start>temp.txt
echo%mypath%>>temp.txt
echo\programfolder\program.exe>>temp.txt
echo-argument-argument>>temp.txt
延迟扩展
定局=
对于(临时文本)中的/f%%a,请执行以下操作(
设置最终版本=!最终版本!%%a
)
echo%FINAL%>input.txt
del/q temp.txt
暂停

开始“按照你的要求去做,我想:

@echo off
if exist "go.bat" go.bat
set /p "mypath=Please specify install directory; "
Echo "%mypath%" ----was what you typed
pause
>"go.bat" echo @start "" "%mypath%\programfolder\program.exe" -argument -argument

请提供一个示例,说明您所期望的和您所得到的。非常感谢您的回复,它可以工作,但是go.bat不要转到保存的目录,而是尝试在当前目录中启动program.exe,Help保存的目录在哪里?