Search found 129 matches

by siberia-man
11 Dec 2019 07:52
Forum: DOS Batch Forum
Topic: The most primitive XML writer (just for fun)
Replies: 7
Views: 140

Re: The most primitive XML writer (just for fun)

Ahh... Sorry for misuderstanding

Code: Select all

xml tag /
for
<tag/>

Code: Select all

xml tag "/"
for
<tag>/</tag>
quite stupid implementation :)
by siberia-man
11 Dec 2019 03:49
Forum: DOS Batch Forum
Topic: The most primitive XML writer (just for fun)
Replies: 7
Views: 140

Re: The most primitive XML writer (just for fun)

Could you explain the reason for the double check in lines like that? : if "%~2" == "/" if [%2] == [/] ( Steffen This is dirty check for the two cases: tag as container :: this produces <tag> call :xml tag empty tag :: this produces <tag></tag> call :xml tag "" It is dirty, actually. The better way...
by siberia-man
09 Dec 2019 20:50
Forum: DOS Batch Forum
Topic: The most primitive XML writer (just for fun)
Replies: 7
Views: 140

The most primitive XML writer (just for fun)

Hello, I've just written the most primitive XML writer in the world. Please don't take it seriously. I made it just for fun :). @echo off setlocal call :xml-new-doc call :xml html call :xml head "" call :xml body call :xml h1 "Greeting..." call :xml p "Hello, world!" call :xml hr / call :xml p "I am...
by siberia-man
06 Sep 2019 17:33
Forum: DOS Batch Forum
Topic: CALL myBatch.bat can return to the wrong place
Replies: 4
Views: 2066

Re: CALL myBatch.bat can return to the wrong place

By this link http://forum.script-coding.com/viewtopic.php?pid=80366#p80366 you can find the research I've made time ago and discussions in Russian. There is translation from summary only. The label name can consist of: -- Latins -- Digits -- Underscore _ -- Punctuation signs . (dot), - (dash) [ and ...
by siberia-man
21 Aug 2019 06:48
Forum: DOS Batch Forum
Topic: How to validate digit number from .txt file
Replies: 8
Views: 3282

Re: How to validate digit number from .txt file

If you need to validate some field is numeric value and it is not more than 6 digits, you have to check that the field is number and is less 1000000. Do something like this: for /f ... %%a in ... do ( call :check_num %%~a && if %%~a lss 1000000 ( do something cool when number is < 1000000 (no more 6...
by siberia-man
18 Aug 2019 15:36
Forum: DOS Batch Forum
Topic: How to validate digit number from .txt file
Replies: 8
Views: 3282

Re: How to validate digit number from .txt file

These three are implementations of one way, practically. 1. @echo off for /f "usebackq skip=1 tokens=1,2,3 delims=," %%a in ( "test.csv" ) do ( setlocal set /a "%%~a=%%~a" 2>nul && echo:%%~a - Not a number endlocal ) 2. @echo off for /f "usebackq skip=1 tokens=1,2,3 delims=," %%a in ( "test.csv" ) d...
by siberia-man
14 Aug 2019 12:26
Forum: DOS Batch Forum
Topic: Format file size of output to KB's and include thousand separator.
Replies: 7
Views: 3271

Re: Format file size of output to KB's and include thousand separator.

Using batch scripting is limited by file size no more 2 G (in fact less than 2^31-1). The following script works in this limitation only. I guess applying some non-trivial tricks could extend usage but the script will become too complicated indeed. @echo off setlocal set "DIGIT_GROUPING=," call :fsi...
by siberia-man
07 Aug 2019 12:14
Forum: DOS Batch Forum
Topic: Trying to build a Uptime.exe alternative via native windows
Replies: 31
Views: 14081

Re: Trying to build a Uptime.exe alternative via native windows

Eureka! wrote:
07 Aug 2019 09:02
Why would anyone try to accomplish this in CMD these days, when there is PowerShell?
Not all systems have powershell by default. A batch syntax is simpler and more familiar to most people. The batch scripting is funnier than powershell.
by siberia-man
05 Aug 2019 23:48
Forum: DOS Batch Forum
Topic: Trying to build a Uptime.exe alternative via native windows
Replies: 31
Views: 14081

Re: Trying to build a Uptime.exe alternative via native windows

Resurrecting the old thread. There is one more implementation of the initial idea. Original code is here https://github.com/ildar-shaimordanov/cmd.scripts/blob/master/bin/uptime.bat I borrowed the idea how to convert YYYYMMDDhhmmss.SSSSSS+zzz to the unix timestamp here https://stackoverflow.com/a/11...
by siberia-man
19 Apr 2019 04:33
Forum: DOS Batch Forum
Topic: gzip batch
Replies: 30
Views: 7131

Re: gzip batch

rename gzip.bat to gz.bat
by siberia-man
18 Apr 2019 02:20
Forum: DOS Batch Forum
Topic: gzip batch
Replies: 30
Views: 7131

Re: gzip batch

you do something not in right way. Please try with a single file and check your results.
by siberia-man
17 Apr 2019 06:57
Forum: DOS Batch Forum
Topic: gzip batch
Replies: 30
Views: 7131

Re: gzip batch

I don't know and can't imagine what have you done. First of all, try to run the script with a single file check the result and go ahead with others.
by siberia-man
16 Apr 2019 14:10
Forum: DOS Batch Forum
Topic: gzip batch
Replies: 30
Views: 7131

Re: gzip batch

geronimo1,

I am so sorry that I have made some rude mistakes. I updated my previous post and fixed them. Please try again.
by siberia-man
16 Apr 2019 06:20
Forum: DOS Batch Forum
Topic: which.exe - The best of Windows where.exe and Unix which, and some more
Replies: 5
Views: 5319

Re: which.exe v1.12 - Now efficiently detecting doskey macros and PS aliases

Yet another "batch only" implementation of the "which" utility can be found here: https://github.com/ildar-shaimordanov/cmd.scripts/blob/master/bin/which.bat :: USAGE: :: which [-a] [--] name [...] :: :: -a Print all available matchings accordingly the description below. :: :: For each of the names ...
by siberia-man
16 Apr 2019 02:01
Forum: DOS Batch Forum
Topic: gzip batch
Replies: 30
Views: 7131

Re: gzip batch

Very simple

Code: Select all

@echo off

setlocal

set "ext_o=.gz"

if /i "%~x1" == ".css"  set "ext_o=.csz"
if /i "%~x1" == ".js"   set "ext_o=.jgz"
if /i "%~x1" == ".html" set "ext_o=.htz"

gzip -c "%~dpnx1" > "%~dpn1%ext_o%"