Text Input

May 11, 2010 at 00:46:55
Specs: Windows 7
I'm trying to have my .bat file let me input a file
location. In this case, it's the location of a
video file. It's been almost 10 years since I
messed around with .bat files and with that,
I'm forgetting a lot of stuff. Basically I need my
bat file to ask me to input the location of the
file, then my Justin.TV username and stream
key. I'll put an example below.


"C:\Program Files
(x86)\VideoLAN\VLC\vlc.exe" -vvv -I rc "

-I need it to wait 2 seconds here.-

cd C:\Users\Doctor\JTVLC

-Wait another 2 seconds-

KEY!! C:\vlc.spd


That's basically it. Thanks.

See More: Text Input

Report •

May 11, 2010 at 06:28:10
Querying text can be done with SET /P

Check the SET command via SET /?

Report •

May 11, 2010 at 09:06:28
I did a quick test just now using only the first part, but the file
closes almost immediately. Again, I've forgotten a lot about
batch files. What am I missing?

EDIT: I got it working, but it doesn't query me to enter text for that first section. Any other ideas?

Report •

May 11, 2010 at 12:13:13
hello. here's a stripped-down abstract version:
@echo off & setlocal
::set all the gobbledygook var.s here:
set /p user=username:
set /p key=streamkey:
::-I need it to wait 2 seconds here.-
choice /t:y,2
cd C:\Users\Doctor\JTVLC
::-wait another 2 seconds-
choice /t:y,2
jtvlc %user% %key% C:\vlc.spd
::------ end

note if you don't have choice.exe, this might work for the
replace the "choice" lines with:
call :timer 2

:: put this subroutine at bottom of script
set x=%time:~0,-3%
set /a c=0
set /a cnt=2
set z=%time:~0,-3%
if %z% neq %x% set /a c+=1 & set x=%z% & echo %c%
if %c% lss %cnt% goto :one
goto :eof

Report •

Related Solutions

May 11, 2010 at 12:30:05
Thanks, nbrane. This seems to be what I need, but I set up the
"SET /P" for use in the vars and after I input the filename, it does
what it's supposed to, but it sorta hangs. It doesn't move on to
the "user" and "stream key" parts. =/

EDIT: I split it into two batch files for now, but when I enter my "user" and "stream key" for the second part, it tells me: "The ssystem cannot find the path specified."

Report •

May 11, 2010 at 13:25:28
You'll prob'ly need to post your code (both parts), as I'm not
sure what you're working with at this point.
the set /p is straighforward command (see: set /?)
it collects the var.s, it will wait until you enter something.
it might be the timer (choice) that's hanging.

Report •

May 11, 2010 at 13:45:44
@echo off & setlocal

set /p user=username:
set /p key=streamkey:
::-I need it to wait 2 seconds here.-

cd C:\Users\Doctor\Desktop\JTVLC
::-wait another 2 seconds-

jtvlc %user% %key% C:\vlc.spd
::------ end

That's what I put for the second batch file. It does what I need
it to do, but then it closes. Besides that, I have it all working
correctly. If I can get this part to work, then I'll move on to
getting them into one file.

Report •

Ask Question