我有一个批处理文件,通过转到目录并检查CONFIG目录是否存在来检测用户是否安装了.Net框架.
如果该目录不存在,则用户没有安装.Net框架.然后批处理文件将继续安装.Net框架.但是,存在一个问题,因为在运行安装程序以安装我的拨号程序之前需要安装.Net框架.所以我放了一个PAUSE语句,这样用户在安装框架后会按任意键继续.
但是,我们的客户不喜欢这样,因为他们的一些客户不理解,他们在框架完成安装之前按下了一个键.这会导致安装失败,因为框架尚未首先安装.
我正在使用等待用户输入的PAUSE.但是,有没有一种方法,批处理将等到框架自动完成而不是使用PAUSE命令?
非常感谢任何建议,
@ECHO OFF
REM Copy the configuration file
copy config.xml "%AppData%\DataLinks.xml"
REM Search for the CONFIG file, if this doesn't exit then the user doesn't have the .Net framework 2.0
SET FileName=%windir%\Microsoft.NET\Framework\v2.0.50727\CONFIG
IF EXIST %FileName% GOTO INSTALL_DIALER
ECHO.You currently do not have the Microsoft(c) .NET Framework 2.0 installed.
ECHO.This is required by the setup program for MyApplication.
ECHO.
ECHO.The Microsoft(c) .NET Framework 2.0 will now be installed on you system.
ECHO.After completion setup will continue to install MyApplication on your system.
ECHO.
REM Install the .Net framework and wait for the user to input before install the dialer
PAUSE
ECHO Installing... Please wait...
SET FileName =
Start .\NetFx20SP2_x86.exe
ECHO Once the .Net Framework has completed. Press any key to continue to install the dialer.
PAUSE
Start .\setup.exe
ECHO ON
EXIT
REM .Net framework has been skipped contine to install the dialer.
:INSTALL_DIALER
ECHO *** Skiped Dotnet Framework 2.0.50727 ***
ECHO Installing... Please wait...
SET FileName=
Start .\setup.exe
ECHO ON
EXIT
Run Code Online (Sandbox Code Playgroud)
Cam*_*tin 13
您可以使用
START /WAIT NetFx20SP2_x86
Run Code Online (Sandbox Code Playgroud)
太.记得那个
REM comment
Run Code Online (Sandbox Code Playgroud)
等于
::comment
Run Code Online (Sandbox Code Playgroud)
使用.\是不必要的,文件扩展名也是如此,除非有名称冲突的目录/文件.您也不需要两次清除"filename"变量("="指向两次)和
ECHO.something
Run Code Online (Sandbox Code Playgroud)
是平等的
ECHO something
Run Code Online (Sandbox Code Playgroud)
只有空行除外