批处理文件从文本文档中获取多个变量

时间:2016-09-30 13:36:49

标签: batch-file variables text

我正在尝试制作一个批处理文件' account'系统,但我不想把用户名和密码放在一边。我希望它们隐藏在文本文件中。我知道可以从文本文件中提取变量,但我只知道如何从文档顶部提取一个变量。我希望每个文档有多个变量,这样就可以有多个帐户'按文件登录。

我的代码:

 @echo off
title Secure Account System (SAS) V 0.1



:ssoa
cls
color 04
echo =--------------=
echo  Hello. Welcome
echo  to the SAS 0.1
echo =--------------=
echo Sign in here.
set /p ssos=Username:
set /p ssod=Password:

if %ssos% == default if %ssod% == user goto baselog

:plzno
echo Don't press enter without correct information.
timeout 2 >nul
goto ssoa

:baselog
cls
color 02
echo =--------------=
echo Default Terminal
echo =--------------=
echo type help for help
set /p termbase=SAS:\default\:

if %termbase% == help goto helpba
if %termbase% == logoff goto ssoa
if %termbase% == end exit

:whydoudo
echo Enter a correct command.
timeout 2 >nul
goto baselog

:helpba
echo help   - Puts you here.
echo logoff - Logs you off.
echo end    - Shuts down the SAS.
pause
goto baselog

这就是我的全部。我需要它来提取变量,以便'if %ssos% == 1 if %ssod% == 2 goto something'  像

一样
'if %ssos% == %pulled_Variable% if %ssod% == %pulledVariable% goto something'

0 个答案:

没有答案