Search found 3646 matches

by aGerman
05 Dec 2019 11:04
Forum: DOS Batch Forum
Topic: CmdRunner - 3d game (CubeRunner clone)
Replies: 31
Views: 7727

Re: CmdRunner - 3d game (CubeRunner clone)

for /L in (0,1,990) do (
Where is the variable name in your FOR /L loop?
Or do you have another problem? (I don't speak Spanish, sorry).
And how is your issue related to the CmdRunner topic?

Steffen
by aGerman
04 Dec 2019 10:16
Forum: DOS Batch Forum
Topic: My program isn't working as it should.
Replies: 2
Views: 55

Re: My program isn't working as it should.

Something like !output[%cell%]! will not work because variable cell was updated in the body of your loop and will not expand to the current value. But first of all it would be nice to know what output you even expect for your given "test.bgem".

Steffen
by aGerman
03 Dec 2019 07:26
Forum: DOS Batch Forum
Topic: jrepl new
Replies: 7
Views: 106

Re: jrepl new

Exactly as I expected. The encoding is UTF-16 Little Endian with a Byte Order Mark.
Update your code like that:

Code: Select all

cmd /c jrepl.bat ",4," ",1," /f "test1.txt|UTF-16" /o "testnew.txt|UTF-16"
Or for my second proposal above, respectively.

Steffen
by aGerman
03 Dec 2019 05:29
Forum: DOS Batch Forum
Topic: jrepl new
Replies: 7
Views: 106

Re: jrepl new

Umm, no. That's rather an encoding problem of your file. Your output looks a little like UTF-16. Try to shorten the file to a few lines, put it into a ZIP archive and upload it here. Probably we are able to find the culprit if we see original data.

Steffen
by aGerman
02 Dec 2019 12:44
Forum: DOS Batch Forum
Topic: jrepl new
Replies: 7
Views: 106

Re: jrepl new

This will replace any occurrence of ",4," ...

Code: Select all

cmd /c jrepl.bat ",4," ",1," /f "test1.txt" /o "testnew.txt"
... while that would only replace occurrences of ",4," if the 4 is the second comma-separated token in a line.

Code: Select all

cmd /c jrepl.bat "([^,]*),4," "$1,1," /b /f "test1.txt" /o "testnew.txt"
Steffen
by aGerman
29 Nov 2019 10:43
Forum: DOS Batch Forum
Topic: Batch DOS - Replace "part of" filenames
Replies: 2
Views: 118

Re: Batch DOS - Replace "part of" filenames

You should use a FOR /F loop with underscore as delimiter.
Untested:

Code: Select all

for %%a in (*_.pdf) do for /f "delims=_" %%b in ("%%~na") do (
  ren "%%~a" "%%b%%~xa"
)
Steffen
by aGerman
28 Nov 2019 18:37
Forum: DOS Batch Forum
Topic: Increment a variable with setx
Replies: 4
Views: 134

Re: Increment a variable with setx

but if i check the global environment with another process the variable X is not incremented. Why? How did you run the other process? Did it inherit a fresh global environment from explorer.exe or did you call it from another process that was already running before you changed the variable using se...
by aGerman
28 Nov 2019 17:38
Forum: DOS Batch Forum
Topic: Increment a variable with setx
Replies: 4
Views: 134

Re: Increment a variable with setx

Processes inherit their environment from the process environment of their parent. Changing the process environment of a child process will not change the environment of its parent. Changing the parent environment of a running child process will not change the environment of its child anymore. Thus, ...
by aGerman
28 Nov 2019 11:29
Forum: DOS Batch Forum
Topic: Internet ping test + say results
Replies: 4
Views: 182

Re: Internet ping test + say results

Could it be possible to add this script 3 times with 3 different sites Sure. Just ping 3 sites and if you get errorlevel 0 for one of them you may assume that you're connected. Perhaps you want to contribute the code for that? Can I get it to speak at all? Oh, you literally talked about speaking. W...
by aGerman
26 Nov 2019 10:50
Forum: DOS Batch Forum
Topic: Internet ping test + say results
Replies: 4
Views: 182

Re: Internet ping test + say results

Easiest way is to ping a common web site, such as google.com @echo off &setlocal >nul ping google.com -n 1 if errorlevel 1 (echo Internet disconnected) else echo Internet connected pause That doesn't protect you from getting a false result if google is down though. Unlikely but still possible. Steffen
by aGerman
24 Nov 2019 07:53
Forum: DOS Batch Forum
Topic: single line in runonce
Replies: 4
Views: 197

Re: single line in runonce

Absolutely. But keep in mind that CALL leads to double parsing. No problem if you use it once. But doing that repeatedly in a loop has the potential to destroy the performance of your script.

Steffen
by aGerman
24 Nov 2019 04:46
Forum: DOS Batch Forum
Topic: single line in runonce
Replies: 4
Views: 197

Re: single line in runonce

If you want to expand a variable to its value in the same command line you have to enable delayed variable expansion using SETLOCAL ENABLEDELAYEDEXPANSION and enclose the variable in exclamation points rather than in percent signs. But that's not necessary since you already have the drive letter in ...
by aGerman
21 Nov 2019 02:53
Forum: DOS Batch Forum
Topic: Old Script on (relatively) new computer
Replies: 11
Views: 319

Re: Old Script on (relatively) new computer

Compare yours

Code: Select all

(
for /F "tokens=*" %%B in ('dir /B/A-D/ONE "%%~nA.0*"') do 
with the proposal of Eureka!

Code: Select all

		for /F "tokens=*" %%B in ('dir /B/A-D/ONE "%%~nA.0*"') do (
and read his comments regarding parentheses.

Steffen
by aGerman
20 Nov 2019 14:29
Forum: DOS Batch Forum
Topic: Start Application At A Specific Transaction With Batch File
Replies: 2
Views: 194

Re: Start Application At A Specific Transaction With Batch File

Not sure what that application actually is that you are talking about. But since Batch doesn't interact with graphical user interfaces I'm afraid you're out of luck.

Steffen
by aGerman
18 Nov 2019 16:55
Forum: DOS Batch Forum
Topic: Employee clock in / clock out .bat
Replies: 10
Views: 364

Re: Employee clock in / clock out .bat

Okay that's from where you can start. @echo off &setlocal :: get the current time values call :GetDateTimeValues year1 month1 day1 hour1 minute1 second1 echo %year1%-%month1%-%day1% %hour1%:%minute1%:%second1% :: delay for testing timeout /t 5 :: again get the current time values call :GetDateTimeVa...