Search found 100 matches

by Sounak@9434
05 Jan 2017 11:16
Forum: DOS Batch Forum
Topic: Advanced Batch features via auxiliary .exe programs
Replies: 74
Views: 88679

Re: Advanced Batch features via auxiliary .exe programs

Hey Antonio, May I make a request for a auxiliary exe program. Can you make a program which will immediately print(or set as errorlevel) the current location of the mouse cursor inside the console window(like in cursorpos.exe which prints the location of console cursor). I have found some tools like...
by Sounak@9434
05 Jan 2017 08:44
Forum: DOS Batch Forum
Topic: Batch security
Replies: 4
Views: 1963

Re: Batch security

Maybe convert them to exe using Advanced bat to exe converter.

Sounak
by Sounak@9434
05 Jan 2017 08:16
Forum: DOS Batch Forum
Topic: FOR command / batch including DIR
Replies: 28
Views: 7960

Re: FOR command / batch including DIR

I thought there might be a way to skip the creation of the filelist.txt and do it all in one like for /f %%a in dir.... ***That is why the title is "For ... including DIR In this case you are talking about the first request. Yeah the code can be achived by directly redirecting the output of di...
by Sounak@9434
05 Jan 2017 02:15
Forum: DOS Batch Forum
Topic: FOR command / batch including DIR
Replies: 28
Views: 7960

Re: FOR command / batch including DIR

I mean you use c:/a/b/c/filelist.txt instead of c:\a\b\c\filelist.txt Sorry, I should have posted it from my pc(android is tricky for typing codes) though yeah my fault. Fixed one here:- for /f "delims=" %%a in ("c:\a\b\c\filelist.txt") do ( cd "c:\d\e\f" if exist &quo...
by Sounak@9434
05 Jan 2017 01:10
Forum: DOS Batch Forum
Topic: FOR command / batch including DIR
Replies: 28
Views: 7960

Re: FOR command / batch including DIR

drgt wrote:Why not using backslashes?

You mean using backslash as delimiter?
by Sounak@9434
04 Jan 2017 22:45
Forum: DOS Batch Forum
Topic: FOR command / batch including DIR
Replies: 28
Views: 7960

Re: FOR command / batch including DIR

For the second one use this(untested) for /f %%a in ("c:/a/b/c/filelist.txt") do ( cd "c:/d/e/f" if exists %%a copy %%a "c:/g/h/i" ) Sounak You might want to account for spaces in file names. Thanks Squashman, new code(untested):- for /f "delims=" %%a in (&qu...
by Sounak@9434
04 Jan 2017 11:42
Forum: DOS Batch Forum
Topic: FOR command / batch including DIR
Replies: 28
Views: 7960

Re: FOR command / batch including DIR

For the second one use this(untested)

Code: Select all

for /f %%a in ("c:/a/b/c/filelist.txt") do (
 cd "c:/d/e/f"
 if exists %%a copy %%a "c:/g/h/i"
)


Sounak
by Sounak@9434
04 Jan 2017 11:33
Forum: DOS Batch Forum
Topic: batch file opens when clicking on a program.
Replies: 2
Views: 1652

Re: batch file opens when clicking on a program.

Maybe without hacking the software itself it's tough to achive. Though if you are using it for yourself or someone who is little literate in computer you can do this- 1) write the batch file you want to run when clicked in the software and save it in the software directory. 2) Write another batch fi...
by Sounak@9434
04 Jan 2017 11:20
Forum: DOS Batch Forum
Topic: Variable inside variable inside for loop?
Replies: 8
Views: 2505

Re: Variable inside variable inside for loop?

To get the value of an element when the index changes inside FOR/IF, enclose the element in double percent symbols and precede the command with CALL. For example, to move a range of array elements four places to the left: for /L %%i in (%start%,1,%end%) do ( set /A j=%%i + 4 call set "elem[%%i...
by Sounak@9434
04 Jan 2017 05:32
Forum: DOS Batch Forum
Topic: Variable inside variable inside for loop?
Replies: 8
Views: 2505

Re: Variable inside variable inside for loop?

aGerman wrote:Or ...

Code: Select all

for /f %%B in ("!var!") do Echo !file%%B!


Steffen

Thanks Steffen for this cool one. :mrgreen:
by Sounak@9434
04 Jan 2017 05:24
Forum: DOS Batch Forum
Topic: Variable inside variable inside for loop?
Replies: 8
Views: 2505

Re: Variable inside variable inside for loop?

Compo wrote:Okay…

Code: Select all

@Echo Off
SetLocal EnableDelayedExpansion
Set "var=0"
For /F "Delims=" %%A In ('Dir/B') Do (
   Set/A var+=1
   Set "file!var!=%%A"
   Call Echo=%%file!var!%%
)
Timeout -1

Thanks. :D
by Sounak@9434
04 Jan 2017 05:09
Forum: DOS Batch Forum
Topic: Variable inside variable inside for loop?
Replies: 8
Views: 2505

Re: Variable inside variable inside for loop?

Compo wrote:Try this:

Code: Select all

@Echo Off
SetLocal EnableDelayedExpansion
Set "var=0"
For /F "Delims=" %%A In ('Dir/B') Do (
   Set/A "var+=1"
   Set "file!var!=%%A"
)
Set file
Timeout -1

Oops, sorry mistakenly I forgot one line. Sorry ,updated the question.
by Sounak@9434
04 Jan 2017 04:23
Forum: DOS Batch Forum
Topic: Variable inside variable inside for loop?
Replies: 8
Views: 2505

Variable inside variable inside for loop?

Okay, here comes another problem (or question) from me. Here I want to expand a variable inside a variable name and then expand the second variable too. If it was not a for loop I would have used:- setlocal enabledelayedexpansion Set foo=1 Set bar1=main Echo !bar%foo%! This code would echo the conte...
by Sounak@9434
31 Dec 2016 01:30
Forum: DOS Batch Forum
Topic: Firefox & Chrome history deleter
Replies: 5
Views: 2732

Re: Firefox & Chrome history deleter

You should add a tasklist check to check if the browser is closed and also a 'if exist' check to know if the browser is installed or not as let's say the person has Chrome installed but not Firefox. As your script deletes Firefox history first it would print 'system cannot find the file path specifi...
by Sounak@9434
30 Dec 2016 07:59
Forum: DOS Batch Forum
Topic: How to speed up a batch script
Replies: 16
Views: 11574

Re: How to speed up a batch script

Another little speedup trick is to clear out all or almost all unused environment variables. I found that all my scripts got a 5-10% speedup by doing this. I found this trick in a script by einstein1969. Just remember to call setlocal first, otherwise the variables are deleted from your actual cmd ...