Search found 32 matches

by Cat
17 Feb 2014 21:59
Forum: DOS Batch Forum
Topic: Proper Logic
Replies: 3
Views: 4061

Re: Proper Logic

Quotes around your variables aren't usually needed, but it looks like just missing percents around 'GoodBit' cause the if statement to fail: @echo off set var1=192.168.1.1 set /a GoodBit=100 for /f "tokens=1 delims=%%" %%b in (c:\temp1a\tmp1.txt) do set /a MyBit=%%b echo MyValue: %MyBit% I...
by Cat
30 Apr 2012 13:18
Forum: DOS Batch Forum
Topic: Color problem
Replies: 15
Views: 14721

Re: Color problem

Anyone try using this (http://bit.ly/IKyEmM) for colors? It's faster and doesn't require filenames
by Cat
26 Apr 2012 14:44
Forum: DOS Batch Forum
Topic: hide entered password with astrics
Replies: 11
Views: 19513

Re: hide entered password with astrics

@ Phillid - I have this in C++ right now, but how do I set a variable (%password%, etc) from the script? #include "stdafx.h" #include <string> #include <conio.h> #include <iostream> #include <cstdlib> #include <stdlib.h> using namespace std; int main(char argc, char *argv[]) { char c; stri...
by Cat
26 Apr 2012 13:30
Forum: DOS Batch Forum
Topic: Different Color text
Replies: 4
Views: 5698

Re: Different Color text

I personally wouldn't recommend using <nul set /p ".="%DEL% " " >> "%~2" findstr /v /a:%~1 /R "^$" "%~2" nul del "%~2" > nul 2>&1 goto :eof 'Bit too slow and it constantly creates and deletes files. Try this: http://bit.ly/Is1MPj
by Cat
25 Apr 2012 19:15
Forum: DOS Batch Forum
Topic: Batch Games
Replies: 31
Views: 65167

Re: Batch Games

Coded this a LONG time ago. Horrible coding, but it's too big for me to really redo. @ECho off :s set a1=_&set a2=_&set a3=_&set a4=_&set b1=_&set b2=_&set b3=_&set b4=_&set c1=_&set c2=_&set c3=_&set c4=_ set d3=_&set d4=_&set e1=_&set e2=_&am...
by Cat
24 Apr 2012 18:17
Forum: DOS Batch Forum
Topic: Encoding / Decoding
Replies: 8
Views: 10752

Re: Encoding / Decoding

I made something like this a while ago, it used a text password to encode the text. Vigenere cipher, I think it's called. @echo off setlocal enabledelayedexpansion set "chars=a b c d e f g h i j k l m n o p q r s t u v w x y z" set "nums=1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19...
by Cat
24 Apr 2012 16:27
Forum: DOS Batch Forum
Topic: hide entered password with astrics
Replies: 11
Views: 19513

Re: hide entered password with astrics

Best I could do with pure batch: @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% choice /c "!chars: =!" >nul if not %errorlevel%==37 ( for /f "...
by Cat
21 Apr 2012 10:32
Forum: DOS Batch Forum
Topic: Check if the file was run as an admin?
Replies: 9
Views: 8128

Check if the file was run as an admin?

Is there any simple way to check if the command window has administrator rights? Right now I have this:

Code: Select all

for /f "tokens=2" %%a in ('netstat -b') do (
if '%%a'=='requested' (
echo Not admin
) else (
echo Admin
))


Any faster / simpler way to know this?
by Cat
17 Apr 2012 12:57
Forum: DOS Batch Forum
Topic: Tools For Batch
Replies: 5
Views: 5910

Re: Tools For Batch

As long as we're on the topic of executable tools, http://www.filedropper.com/multicol this is one that I made a little while back. It's a pretty simple C++ script that prints text in different colors.
by Cat
15 Apr 2012 22:49
Forum: DOS Batch Forum
Topic: Missing operator???
Replies: 3
Views: 5023

Re: Missing operator???

Is this just trying to do exponents? Either try "exit /b" for "GOTO :EOF" or:

Code: Select all

@echo off
set base=3
set mult=%base%
set power=3
for /l %%a in (2,1,%power%) do set /a mult*=%base%
echo %mult%
pause

Both ideas untested, though.
by Cat
10 Apr 2012 14:57
Forum: DOS Batch Forum
Topic: ASCII in batch
Replies: 6
Views: 20908

Re: ASCII in batch

I'm a bit late for this, aren't I?

Use the alt code (█ = Alt + 219) using the number with a 0 in front of it. (Û = Alt + 0219)

Code: Select all

@echo off
echo Û
echo ±
echo °
pause
by Cat
25 Feb 2012 12:31
Forum: DOS Batch Forum
Topic: Explorer selection?
Replies: 8
Views: 7277

Explorer selection?

Is there any way (extensions, etc) to use an explorer selection screen in batch to assign a full file path name to a variable? Like this: http://img837.imageshack.us/img837/2583/3fdca9f24c234f58822a49a.png And when you select a file and click "open" it sets, say, %file% to the full path of...
by Cat
15 Feb 2012 23:29
Forum: DOS Batch Forum
Topic: Batch Programming Help - Renaming Files
Replies: 12
Views: 11210

Re: Batch Programming Help - Renaming Files

@echo off Setlocal enabledelayedexpansion For /f  %%a in ('dir /b') do ( Set file=%%a If !file:txt=! Neq !file! ( For /f "tokens=1" %%b in (%file%) do set export=%%b Del %file% Echo %file% >> %export%.txt )) Exit /b I don't see any problems with it like that. I'm away from my computer sub...
by Cat
15 Feb 2012 23:10
Forum: DOS Batch Forum
Topic: Batch Programming Help - Renaming Files
Replies: 12
Views: 11210

Re: Batch Programming Help - Renaming Files

The code I posted only works when the batch is run elsewhere on the computer, and no other files but text docs are in c:\files. From your reply to foxidrive, you'd probably want to get the contents of the file and save it then delete the file itself. Try this instead: @echo off For /f  %%a in ('dir ...
by Cat
15 Feb 2012 21:48
Forum: DOS Batch Forum
Topic: Batch Programming Help - Renaming Files
Replies: 12
Views: 11210

Re: Batch Programming Help - Renaming Files

This works fine for me:

Code: Select all

@echo off
Cd /d c:\files
For /f  %%a in ('dir /b') do (
For /f "tokens=1" %%b in (%%a) do ren %%a %%b.txt
)