Search found 32 matches
- 14 Feb 2012 22:24
- Forum: DOS Batch Forum
- Topic: Capturing tokens only once from two .txt files?
- Replies: 8
- Views: 7352
Capturing tokens only once from two .txt files?
I'm writing a code that will combine lines from two text files. The first text file contains: A B C D The second one contains: 1 2 3 4 I want the output to be: A 1 B 2 C 3 D 4 Any ideas how to make this work? My best attempt results with: A 1 A 2 A 3 A 4 B 1 B 2 B 3 B 4 C 1 ... And so on like that. ...
- 11 Jan 2012 00:11
- Forum: DOS Batch Forum
- Topic: IF STATEMENT DOESNT RUN
- Replies: 3
- Views: 4149
Re: IF STATEMENT DOESNT RUN
Try this: @echo off&color A :n set /p a="Program name:"&set /a X=1 echo\&echo Please write your program here: :run set /a X+=1 set /p li=%X% echo.%li%>>%a%.bat if /i "%li%" EQU "exit"(goto :exit) goto run :exit cls&echo making in progress... timeout /t 3...
- 01 Jan 2012 04:16
- Forum: DOS Batch Forum
- Topic: Useful software gone?
- Replies: 6
- Views: 5985
Re: Useful software gone?
You could try using this instead: call :coltext 74 "hello" & call :coltext 47 "world" /n ::... :coltext for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do set "DEL=%%a" echo off <nul set /p "...
- 31 Dec 2011 18:57
- Forum: DOS Batch Forum
- Topic: Adding spaces to a text string.
- Replies: 1
- Views: 2493
Adding spaces to a text string.
Is there any way to add spaces after each letter in a text string?
For example, "cat" would become "c a t ".
Spaces can be removed later by using "set str=!str: =!". However, doing this in reverse doesn't work.
Any ideas?
For example, "cat" would become "c a t ".
Spaces can be removed later by using "set str=!str: =!". However, doing this in reverse doesn't work.
Any ideas?
- 13 Dec 2011 19:04
- Forum: DOS Batch Forum
- Topic: CHOICE fallthrough?
- Replies: 0
- Views: 7037
CHOICE fallthrough?
I am writing a code to mask user password input, since there is no command for this. Here is what i have: @echo off setlocal enabledelayedexpansion set chars=q w e r t y u i o p a s d f g h j k l z x c v b n m 1 2 3 4 5 6 7 8 9 0 :input cls echo input password: if defined display echo %display% choi...
- 27 Nov 2011 14:23
- Forum: DOS Batch Forum
- Topic: How to use %0, %1, %2, etc. and the SHIFT command
- Replies: 2
- Views: 7606
How to use %0, %1, %2, etc. and the SHIFT command
How do I use and set replaceable parameters such as %1 in batch?
How does the SHIFT command work with these?
How does the SHIFT command work with these?
- 27 Nov 2011 10:54
- Forum: DOS Batch Forum
- Topic: Value of the value set to a variable?
- Replies: 5
- Views: 6157
Re: Value of the value set to a variable?
it works for me setlocal enabledelayedexpansion set test=96 set /p 96="random prompt : " if "!%test%!" == "7" echo Seven That only seems to work with numbers, not text strings: setlocal enabledelayedexpansion set test=cat set /p 96="random prompt : " if "...
- 26 Nov 2011 22:38
- Forum: DOS Batch Forum
- Topic: just questions
- Replies: 10
- Views: 8515
Re: just questions
some examples:
would output:
to use GOTO, use labels.
would output:
Code: Select all
set cat=13
set dog=7
echo %dog%
echo %cat%
would output:
Code: Select all
13
7
to use GOTO, use labels.
Code: Select all
:loop
echo Hello world
pause
goto loop
would output:
Code: Select all
Hello World
Press any key to continue...
- 26 Nov 2011 22:31
- Forum: DOS Batch Forum
- Topic: Value of the value set to a variable?
- Replies: 5
- Views: 6157
Re: Value of the value set to a variable?
To be more specific, here is the exact portion of code: :input set "X%X%Y%Y%= " choice /c awsd /n >nul if %errorlevel%==1 ( if %Y% GTR 1 ( set /a Y=%y%-1 ) else ( goto lose ) ) if %errorlevel%==2 ( if %x% GTR 1 ( set /a x=%x%-1 ) else ( goto lose ) ) if %errorlevel%==3 ( if %X% LSS 17 ( se...
- 26 Nov 2011 21:57
- Forum: DOS Batch Forum
- Topic: Value of the value set to a variable?
- Replies: 5
- Views: 6157
Value of the value set to a variable?
Here is an example:
say %96% is set to 7. I want to activate a condition for %test% to check the variable of %96%:
None of the above works. How do i fix this?
Code: Select all
set test=96
set /p 96="random prompt"
say %96% is set to 7. I want to activate a condition for %test% to check the variable of %96%:
Code: Select all
if %%test%%==7 echo 7
if %!test!%==7 echo 7
if !%test%!==7 echo 7
None of the above works. How do i fix this?
- 15 Nov 2011 14:36
- Forum: DOS Batch Forum
- Topic: Special characters in batch files?
- Replies: 4
- Views: 5879
Re: Special characters in batch files?
Using "ECHO " will result as "ECHO is on." Also, you can't set a variable to a space.
- 14 Nov 2011 14:36
- Forum: DOS Batch Forum
- Topic: Special characters in batch files?
- Replies: 4
- Views: 5879
Special characters in batch files?
This is a picture of a batch game I'm making. http://i44.tinypic.com/qpfdpd.png I use ± for the blocks, but how do i get rid of the underscores, and put a blank space instead? Alt + 0160 doesn't work, and neither does Alt + 255. How do i place an empty, blank space when a variable is echoed without ...
- 13 Nov 2011 10:01
- Forum: DOS Batch Forum
- Topic: Bash rename files
- Replies: 1
- Views: 2729
Re: Bash rename files
Try REN
Code: Select all
ren "Kate Ryan - LoveLife Video tape.tv.flv.mp3" "Kate Ryan - LoveLife.mp3"
- 11 Nov 2011 19:04
- Forum: DOS Batch Forum
- Topic: Checking a condition from a list of variables?
- Replies: 4
- Views: 4003
Re: Checking a condition from a list of variables?
That works perfectly, thanks
- 11 Nov 2011 18:01
- Forum: DOS Batch Forum
- Topic: Checking a condition from a list of variables?
- Replies: 4
- Views: 4003
Re: Checking a condition from a list of variables?
I'm getting "A12 was not expected at this time" and the window closes. :S