chris
chris

Reputation: 161

Batchfile to save one line of text

Im trying to make a script that saves a user text input were it can type its disered database name and after that he pressed enter and it will be saved as Userconfig.txt to the fixed location.

I need this for a other program to get the database name the user wants.

So basicly it has to be that the user only has to type its pc name and the others settings are fixed.

Anyone able to help me?

REM check 
if not ["%ProgramW6432%"]==[""] ( 
    set "pf=%ProgramFiles(x86)%" 
) else ( 
  set pf="%ProgramFiles%"
)
REM USE
@echo ??textinput?? >> "%pf%\B4ict\IQ-Soft\Userconfig.txt"

Upvotes: 0

Views: 42

Answers (1)

JosefZ
JosefZ

Reputation: 30123

After all chat:

REM check 
if not ["%ProgramW6432%"]==[""] ( 
    set "pf=%ProgramFiles(x86)%" 
) else ( 
  set "pf=%ProgramFiles%"
)
rem input
set /P "textinput=type your desired database name and hit <Enter>: "

rem check to ensure user input is valid database name here

REM USE
@echo %textinput% >> "%pf%\B4ict\IQ-Soft\Userconfig.txt"

Upvotes: 2

Related Questions