Reputation: 23
I want something similar to printf
& scanf
in C in batch scripting?
This is my script
for /F "delims=;" %%i in (servers11.txt) do (
type \\triss-s02-vm\ITG\Triton\GroupConfig.csv | grep -i %%i > temp13.txt
REM type temp.txt | gawk -F"," '{print $1}'
)
Here I am creating servers11.txt
manually and entering value there. I want to enter it from command prompt. Please help me in doing that.
Upvotes: 1
Views: 676
Reputation: 200193
If you want to create a file from scratch on the command line, use copy con
:
C:\>copy con servers11.txt
serverA
serverB
^Z
C:\>type servers11.txt
serverA
serverB
C:\>_
You end copy con
by typing Ctrl+Z,Enter (the ^Z
above).
Upvotes: 1
Reputation: 26120
you can use SET /P to ask for user input :
set /P SERV=SERVERNAME?
echo %SERV% >> temp13.txt
Upvotes: 1