Search found 3544 matches

by aGerman
20 Aug 2019 08:11
Forum: DOS Batch Forum
Topic: Include only the run date data in the WININIT output.
Replies: 4
Views: 950

Re: Include only the run date data in the WININIT output.

Code: Select all

Powershell -Command "& "Get-winevent -FilterHashTable @{logname='Application'; id='1001'}^|?{$_.providername -match 'wininit'} ^| select-object -first 1 ^| fl timecreated, message ^| out-file '%Log%'"
… not tested though …

Steffen
by aGerman
20 Aug 2019 06:59
Forum: DOS Batch Forum
Topic: Include only the run date data in the WININIT output.
Replies: 4
Views: 950

Re: Include only the run date data in the WININIT output.

That's rather related to PowerShell than a Batch question.
Try to pipe the output of where-object (?{...}) to

Code: Select all

select-object -first 1
Steffen
by aGerman
19 Aug 2019 14:57
Forum: DOS Batch Forum
Topic: Add output message if file is empty [0 KB].
Replies: 2
Views: 876

Re: Add output message if file is empty [0 KB].

Probably this way.

Code: Select all

for %%R in ("%userprofile%\Desktop\x.txt") do if %%~zR equ 0 (
  del "%userprofile%\Desktop\x.txt"
  echo NO ERRORS FOUND, deleting file.
) else echo The file was created successfully.
Steffen
by aGerman
18 Aug 2019 05:51
Forum: DOS Batch Forum
Topic: CONVERTCP.exe - Convert text from one code page to another
Replies: 85
Views: 42264

Re: CONVERTCP.exe - Convert text from one code page to another

I found that increasing of allocated memory using realloc() in the conversion routine may lead to copying of data to another location in physical memory. This is unnecessary since the old content is outdated at this point. Additionally CONVERTCP v6.4 supports BOM processing of GB-18030 encoded strea...
by aGerman
13 Aug 2019 12:32
Forum: DOS Batch Forum
Topic: CmdBkg - use bitmap as background to console window
Replies: 41
Views: 9778

Re: CmdBkg - use bitmap as background to console window

Works for me on Win10 Home x64 version 1903 (10.0.18362.267).
I guess people either try to run cmdbkg.exe via double click or they don't use the START command in a batch code.

Steffen
by aGerman
13 Aug 2019 10:45
Forum: DOS Batch Forum
Topic: Send certutil output directly to a variable instead of file, and then finally copy to clipboard?
Replies: 6
Views: 1743

Re: Send certutil output directly to a variable instead of file, and then finally copy to clipboard?

Nope. Certutil will always write the encoded content to a file. Furthermore URIs don't have newlines and the string length in Batch is restricted. Eventually you need at least two temporary files. @echo off &setlocal :: file to be encoded set "file=reddot.png" :: begin of the URI set "uribegin=data:...
by aGerman
11 Aug 2019 07:55
Forum: DOS Batch Forum
Topic: Problem with random number generator
Replies: 3
Views: 1690

Re: Problem with random number generator

If that is your entire code then it's already weird to begin with a label. But it may explain the behavior you're facing. In case you saved the code in a Unicode charset, a byte order mark might be misinterpreted as drive letter because the first character after the BOM is the colon prepending the P...
by aGerman
11 Aug 2019 06:16
Forum: DOS Batch Forum
Topic: SORT Order not working correction
Replies: 8
Views: 2674

Re: SORT Order not working correction

I absolutely agree with Antonio in this case.
Once you really need a logical sorting you can use this hybrid macro:
Sort logically like in Windows Explorer (Powershell hybrid)

Steffen
by aGerman
11 Aug 2019 06:11
Forum: DOS Batch Forum
Topic: Sort logically like in Windows Explorer (Powershell hybrid)
Replies: 1
Views: 1303

Sort logically like in Windows Explorer (Powershell hybrid)

If an Explorer list view is sorted by name then digits are taken as numeric values rather than text. Furthermore the sorting ignores the case of characters. The API function used to compare the file names is StrCmpLogicalW which is not accessible in Batch. However, we can use Batch to call Powershel...
by aGerman
08 Aug 2019 13:13
Forum: DOS Batch Forum
Topic: [Help] Image in batch file
Replies: 12
Views: 4731

Re: [Help] Image in batch file

I am the author of insertbmp. I did several tests and I confirm that this tool doesn't work using the new Windows 10 console. It still inserts the image, but it persists only as long as the insertbmp.exe process lives (some milliseconds). That means Microsoft changed something in the new console hos...
by aGerman
04 Aug 2019 02:23
Forum: DOS Batch Forum
Topic: Animated loading screen
Replies: 8
Views: 3506

Re: Animated loading screen

I hoped I was clear enough:
In the main code I use a loop that counts its iterations in variable n. It's just a useless example for a task that takes some time and you have to replace it with your own code.
What did you try and what didn't work?

Steffen
by aGerman
04 Aug 2019 02:18
Forum: DOS Batch Forum
Topic: [Help] Image in batch file
Replies: 12
Views: 4731

Re: [Help] Image in batch file

Yes, CmdBkg is definitely the better choice. Not only that I don't know the reason why insertbmp doesn't work anymore, it would only draw in the console window itself which makes the image volatile.

Steffen
by aGerman
23 Jul 2019 13:08
Forum: DOS Batch Forum
Topic: Change the value of errorlevel for testing purposes
Replies: 2
Views: 1833

Re: Change the value of errorlevel for testing purposes

Easiest way to set the errorlevel to a certain value:

Code: Select all

cmd /c exit 5
echo %errorlevel%
Steffen
by aGerman
21 Jul 2019 10:44
Forum: DOS Batch Forum
Topic: Problem with "start" command
Replies: 5
Views: 2691

Re: Problem with "start" command

As long as Log.txt is in the current directory, that should be sufficient:

Code: Select all

start "" "Log.txt"
Steffen
by aGerman
17 Jul 2019 15:45
Forum: DOS Batch Forum
Topic: simple script
Replies: 2
Views: 1801

Re: simple script

Remove all spaces around the = in every SET statement.

Steffen