我正在制作小program...So,如果你是新用户,程序必须打开要求私密性的新程序。
所以我做了这样的东西:
:reg
if exist reg.txt goto home
if not exist reg.txt goto firsttime“第一次”是:
:firsttime
cls
echo Welcome! Bla bla bla
*making reg.txt so when you start app next time
it wont open firsttime anymore*但是程序每次都让我第一次看到!有人能帮我吗?谢谢!<3
发布于 2016-02-14 05:57:37
重写行以读:
:reg
if exist "%USERPROFILE%\reg.txt" (goto :home) Else (goto :firsttime)
Goto :EOF这将查找用户配置文件文件夹中的文件,但可以将其更改为任何其他文件夹。
您需要指定文件的完整路径,否则它可能会找错位置。您可以使用C:\或共享\文件夹路径,但需要给出它。
发布于 2016-02-14 06:11:29
如果没有比你发布的代码更多的代码,就不可能知道。
这可能是您的代码“通过”到:firsttime -没有它,我们无法判断。
我会把这写成
:reg
set "regfile=c:\reg.txt"
if exist "%regfile%" goto home
:: First time through
cls
echo Blah blah blah
...
echo something>"%regfile%"
:home当然,精确的绝对路径名和文件名完全取决于您。
您可能(未指定)希望在路径或文件名中包含用户名,或者您可能希望将多个用户的所有数据存储在一个单独的文件中(未指定),并且需要一种完全不同的方法.
https://stackoverflow.com/questions/35371565
复制相似问题