Search found 541 matches

by Compo
01 Oct 2021 16:14
Forum: DOS Batch Forum
Topic: wmic os get BuildNumber
Replies: 3
Views: 1530

Re: wmic os get BuildNumber

Is this a trick question????? Your thread title is the exact code that gets the operating system build number. And just to be a little less cryptic; I suppose the first thing you should do is to review your own code, and fix your obvious typo's. Changing BIOS Get Get BuildNumbe to OS Get BuildNumbe...
by Compo
30 Sep 2021 17:32
Forum: DOS Batch Forum
Topic: How to get READONLY Status for Current disk drive (usb) - like diskpart/attr disk
Replies: 15
Views: 3239

Re: How to get READONLY Status for Current disk drive (usb) - like diskpart/attr disk

Thank you very much friend, but this script does not work on target operating system (windows 7 up to 10 - PT-BR). but I'll save your tip for newer versions. Well your question, at the time of both the original code and my repost of it, did not stipulate the Operating Systems it must work on, and o...
by Compo
30 Sep 2021 12:04
Forum: DOS Batch Forum
Topic: How to get READONLY Status for Current disk drive (usb) - like diskpart/attr disk
Replies: 15
Views: 3239

Re: How to get READONLY Status for Current disk drive (usb) - like diskpart/attr disk

Hi again, well, as I still haven't got an alternative, <Snip> </Snip> I'm still looking for an alternative to Diskpart... I thought that my previous reply may have been an alternative? Granted it is untested, and is only available in Windows 8/Server 2012 onwards Here's a quick untested idea: @Set ...
by Compo
29 Sep 2021 14:52
Forum: DOS Batch Forum
Topic: How to get READONLY Status for Current disk drive (usb) - like diskpart/attr disk
Replies: 15
Views: 3239

Re: How to get READONLY Status for Current disk drive (usb) - like diskpart/attr disk

If your batch file is already running from that drive, then it cannot be 'read only', just 'read', as it clearly has the 'execute' attribute! Are you therefore trying to determine whether the root directory, and/or its children are writeable? or something else? Here's a quick untested idea: @Set "DL...
by Compo
28 Sep 2021 08:58
Forum: DOS Batch Forum
Topic: display time in 12 hr
Replies: 25
Views: 15965

Re: display time in 12 hr

Sorry atfon, I did not see your edit, until afterwards, either way, my point was the same, the settings changed, just not manually.
by Compo
28 Sep 2021 08:38
Forum: DOS Batch Forum
Topic: display time in 12 hr
Replies: 25
Views: 15965

Re: display time in 12 hr

Yes atfon, you've changed your settings between both of those examples! It clealy shows in your two outputs, that the first item has a -300 minute offset from UTC, and the second a -240 minute offset from UTC. The behavior you're reporting therefore is not with WMI, but with changes to your current ...
by Compo
27 Sep 2021 17:28
Forum: DOS Batch Forum
Topic: Efficient Code
Replies: 7
Views: 1952

Re: Efficient Code

Just perform a variable expansion and substitution on %PC%. The following snippet would replace both / and , with nothing … @Set "PC=%PC:/=%" @( Echo Event,Date,Time,Device,User,IP,SN,Model Echo Login,%DATE%,%TIME:~,8%,%COMPUTERNAME%,%USERNAME%,%IP%,%SN:~,20%,%PC:,=% ) 1>"//PC500/Demo/Source/%RANDOM...
by Compo
26 Sep 2021 17:37
Forum: DOS Batch Forum
Topic: Efficient Code
Replies: 7
Views: 1952

Re: Efficient Code

If there is always only one IP Address, and at login that address is already determined, and both of your shown WMIC queries return actual values, i.e. they are never empty, then I would say it could certainly be made more efficient. The reason is that WMIC.exe is historically a relatively slow comm...
by Compo
03 Sep 2021 07:46
Forum: DOS Batch Forum
Topic: Powershell Performance Recommendations
Replies: 15
Views: 1997

Re: Powershell Performance Recommendations

Hello Compo. Thank you for your multitude of critiques. As I've pointed out more than once, I'm still learning and welcome suggestions. It doesn't seem that you were very welcoming of my critique. I did not just make a blanket statement, I explained why I thought that your variation was not as good...
by Compo
02 Sep 2021 20:40
Forum: DOS Batch Forum
Topic: Powershell Performance Recommendations
Replies: 15
Views: 1997

Re: Powershell Performance Recommendations

Why did you change the code I provided? Whilst I'm all for having a particular style etc. I don't understand why you'd use a variation which defines a minimum of four, possibly five variables and uses two for loops, over one which defines only one variable and uses one for loop. Additionally, your v...
by Compo
02 Sep 2021 13:48
Forum: DOS Batch Forum
Topic: Powershell Performance Recommendations
Replies: 15
Views: 1997

Re: Powershell Performance Recommendations

Just to provide a small counter argument to your statement In my script I have occasions to grab information which is not available from the command line. The information you require in your example script is available without resorting to PowerShell. The following is OS dependent (Windows 8 / Serve...
by Compo
17 Aug 2021 09:43
Forum: DOS Batch Forum
Topic: DOS batch file or something else?
Replies: 2
Views: 1099

Re: DOS batch file or something else?

You need to provide more details, including, but not limited to: Are we to assume that there will only ever be files with the .RAW and .JPG extensions in that directory? Will there ever be files with a .RAW or .JPG extension which does not have a matching extension of the other type? You are after a...
by Compo
29 May 2021 16:50
Forum: DOS Batch Forum
Topic: Need help
Replies: 24
Views: 4459

Re: Need help

Or perhaps just this in the Command Prompt:

Code: Select all

%__AppDir__%findstr.exe /IS "Echo" Z:\*.bat
Which should list the full filename, the line number, and then the line containing the case insensitive string Echo of every .bat file on the Z: drive.
by Compo
27 Apr 2021 10:10
Forum: DOS Batch Forum
Topic: Taskkill %0
Replies: 6
Views: 2096

Re: Taskkill %0

TASKKILL /F /FI "WINDOWTITLE EQ "%0"" would work if the i would not add "- file1" and so on. But if I add * to this command it doesn't work: TASKKILL /F /FI "WINDOWTITLE EQ "%0" *" Where is my mistake or does it not work this way? Untested, but have you tried including the wildcard within the doubl...
by Compo
20 Apr 2021 07:42
Forum: DOS Batch Forum
Topic: Windows (and Office?) product key finder
Replies: 13
Views: 3826

Re: Windows (and Office?) product key finder

My script runs correctly in Windows 10. Okay, let me put this to you in a different way; your script does not work correctly in Windows 10 x64, if it is run in a 32-bit cmd.exe instance. It only works correctly in a 64-bit cmd.exe instance, on a Windows x64 OS, and a 32-bit cmd.exe instance on a Wi...