Search found 126 matches

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: 1368

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: 2813

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: 2813

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: 2876

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: 12861

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: 12861

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: 6056

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: 6056

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: 6056

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: 6056

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: 2970

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: 6056

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%"
by siberia-man
22 Mar 2019 15:40
Forum: DOS Batch Forum
Topic: Change chrome homepage using batch
Replies: 18
Views: 3585

Re: Change chrome homepage using batch

@Boxof, What do you mean saying 'chrome homepage'? Does it mean the home or working directory where the application stores its temporary and persistent files? If your answer is yes, so I can suggest you to use command line options that are supported by chrome: "<CHROME-BIN>\chrome.exe" --user-data-d...
by siberia-man
08 Feb 2019 06:30
Forum: DOS Batch Forum
Topic: Call and goto may fail when the batch file has Unix line endings
Replies: 16
Views: 3740

Re: Call and goto may fail when the batch file has Unix line endings

Yes. I can confirm this issue with labels. Batch files stored with EOL in Unix style still continue working but fail when jump to a label is needed. I encountered this trouble when stored a batch file to git. (offtop: the line ending is very annoying issue I have ever faced in my practice with git).
by siberia-man
28 Jan 2019 02:34
Forum: DOS Batch Forum
Topic: Is there any standard equivalent of a .bashrc script for cmd?
Replies: 10
Views: 2239

Re: Is there any standard equivalent of a .bashrc script for cmd?

Thank you, jeb . This is significantly important notice. Does this trick 100% reliable? Someone can a) launch the second instance of cmd.exe using the quoted and full path to it; b) or launch cmd.exe with parameters. Will the trick be able to recognize them and react properly (to configure new sessi...