输入变量成一个文本文件,用一个批处理文件 [英] Inputting a variable into a text file, using a batch file

查看:104
本文介绍了输入变量成一个文本文件,用一个批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我想,使用户设置一个密码,该密码加载到供以后使用要提取的文本文件,使之。现在的问题是,而不是输入变量,在文本文件中的用户输入,这类型的'ECHO处于关闭状态(或ECHO是,如果是上)。

So I'm trying to make it so that the user sets a password, and that password is loaded into a text file to be extracted for later use. The problem is, instead of typing the variable that the user inputs in the text file, it types 'ECHO is off' (or ECHO is on, if it's on).

下面是我写的。

cls
set/p pass = Please enter your password:
> "p.txt" (@echo %pass%)
echo Password created!

在此先感谢!

编辑:感谢MC ND,我有办法! 设置/ P通=请输入您的密码:

Thanks to MC ND, I have the solution! set /p "pass= Please enter your password:"

推荐答案

空格

set/p pass = Please enter your password:
          ^ This space is included in the name of the variable

所以,你的变量名为%的合格%。更改为

set /p "pass= Please enter your password:"

这篇关于输入变量成一个文本文件,用一个批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆