Search found 39 matches

by OJBakker
20 Oct 2020 06:17
Forum: DOS Batch Forum
Topic: Creating a custom html generator in batch
Replies: 9
Views: 275

Re: Creating a custom html generator in batch

echo "<iframe src='myfile.html' frameborder='0' height='100%' width='100%'></iframe>" > index.html echo "myfile.html here" >myfile.html rem set variables with set "var=..." to get rid of the double quots. set "var1=<iframe src='myfile.html' frameborder='0' height='100%' width='100%'></iframe>" set ...
by OJBakker
19 Sep 2020 16:41
Forum: DOS Batch Forum
Topic: Firewall Blocker for Windows - Using netsh.exe
Replies: 2
Views: 392

Re: Firewall Blocker for Windows - Using netsh.exe

The opposite of 'add rule' is 'delete rule'

See

Code: Select all

netsh advfirewall firewall delete rule /?
by OJBakker
18 Sep 2020 03:12
Forum: DOS Batch Forum
Topic: How to pass "chcp 1252" command to START "" /B /WAIT program?
Replies: 4
Views: 512

Re: How to pass "chcp 1252" command to START "" /B /WAIT program?

try these start "" /NORMAL /B /WAIT >nul "%windir%\system32\chcp.com" 1252 & "D:\foobar\myprog.exe /parm1 /parm2 someparm” start "" /NORMAL /B /WAIT >nul "chcp" 1252 & "D:\foobar\myprog.exe /parm1 /parm2 someparm” start "" /NORMAL /B /WAIT >nul chcp 1252 & "D:\foobar\myprog.exe /parm1 /parm2 somepar...
by OJBakker
17 Sep 2020 04:43
Forum: DOS Batch Forum
Topic: How to handle file names with &
Replies: 2
Views: 475

Re: How to handle file names with &

protect set variable from special characters by using double quotes. change set var=value to set "var=value" protect echo variable from special characters by using double quotes. change echo %var% to echo "%var%" The quotes will be visible in the output. If you don't want visible quotes you will hav...
by OJBakker
11 Sep 2020 03:12
Forum: DOS Batch Forum
Topic: command retunrs no value even though entry exists
Replies: 16
Views: 1269

Re: command retunrs no value even though entry exists

Is seems there is something in you Folders.txt that is not visible in the lines you have posted. You need to examine what is going on inside the for-loop to see why it fails on Runescape. Add the following code to yout batchfile, run it and check the new file FolderDEBUG.txt "%SrcPath%\foldersDEBUG....
by OJBakker
30 Aug 2020 06:23
Forum: DOS Batch Forum
Topic: Copy Filename - Copy File to other directory - duplicate file - filename+continuous numerating
Replies: 12
Views: 1169

Re: Copy Filename - Copy File to other directory - duplicate file - filename+continuous numerating

In your code you only keep the last 4 characters of the file. This is probably an attempt to just keep the extension including separator dot between filename and extensions. This is wrong because the extension length can vary between zero (no extension) and a lanrge number, example file: a.bcdefghij...
by OJBakker
08 Aug 2020 13:08
Forum: DOS Batch Forum
Topic: [SOLVED] Output gets directed to the wrong folder!
Replies: 2
Views: 794

Re: Output gets directed to the wrong folder!

Your "Report.bat" is located in PBU\bin
So your code expands to PBU\bin\Reports\Reports.txt
The code below will set the Output_File to PBU\Reports\Reports.txt

Code: Select all

cd /d "%~dp0"
set "Output_File=..\Reports\Report.txt"
by OJBakker
02 Aug 2020 14:12
Forum: DOS Batch Forum
Topic: FOR variable %%A in macro definition gets overridden when script is called by other script within FOR loop
Replies: 15
Views: 1641

Re: FOR variable %%A in macro definition gets overridden when script is called by other script within FOR loop

The problem is in the for''s. You don't want the %%A used when you define your macro but only when you use the macro. The cause of your problem is the for %%g loop in caller.cmd. This for loop makes the %%A available in the do command block. In your example code you don't need this loop. replace for...
by OJBakker
01 Aug 2020 13:10
Forum: DOS Batch Forum
Topic: Categorize file extension in .txt output
Replies: 3
Views: 909

Re: Categorize file extension in .txt output

unttested, but this should be close to what you are trying to achieve.

Code: Select all

if exist Files.txt del Files.txt
for %%A in (asi ini cs asi) do dir /O:D /T:W  *.%%A >> Files.txt
for %%A in (asi ini cs asi) do dir /O:D /T:W  /s *.%%A >> Files.txt
by OJBakker
12 Jun 2020 13:52
Forum: DOS Batch Forum
Topic: Batch hex edit offset from filename
Replies: 8
Views: 1672

Re: Batch hex edit offset from filename

For work I regularly end up with a bunch of hex files with the extension .hex, but I can have anywhere from 5 all the way up to in the hundreds. Most of the time the files will be the same, but require me to open them and edit a select set of values before saving and closing. Right now I am using H...
by OJBakker
07 Apr 2020 01:45
Forum: DOS Batch Forum
Topic: Batch - Browse directory not work
Replies: 3
Views: 1354

Re: Batch - Browse directory not work

Your subroutine :treatment is missing the 'end subroutine' command.
This causes processing of :treatment to continue with the command in :end, so processing stops with the''exit %CodeRetour%' command.

Add 'exit/B' or 'goto :eof' at the end of the subroutine to correct this.
by OJBakker
28 Feb 2020 06:03
Forum: DOS Batch Forum
Topic: How to replace extension of a filename stored in variable?
Replies: 6
Views: 4429

Re: How to replace extension of a filename stored in variable?

The 'set "file2=%%~i"' does work, but is done inside the for-commandblock enclosed in ()
Use delayed expansion to echo and use the uptodate value of %file2%.
Change %file2% in !file2! and %newfile2% in !newfile2! and your code will work as expected.
by OJBakker
07 Dec 2011 15:14
Forum: DOS Batch Forum
Topic: Searching Double quote using FINDSTR inside FOR
Replies: 4
Views: 3315

Re: Searching Double quote using FINDSTR inside FOR

or with less carets but more ""

Code: Select all

FOR /f "tokens=1 delims=:" %a in ('"FINDSTR /n /c:"^"" s.txt"') do echo %a
by OJBakker
03 Dec 2011 19:12
Forum: DOS Batch Forum
Topic: Help me escape special characters used in a %VAR% variable
Replies: 10
Views: 3839

Re: Help me escape special characters used in a %VAR% variab

I am not entirely sure but these might work:
SET COMMAND=('find /n "" < %2')
SET COMMAND=('find /n "" %2')


The first: leave out the caret
The second: leave out the redirect, find does not need it