Search found 108 matches

by atfon
22 Oct 2021 07:01
Forum: DOS Batch Forum
Topic: DOS Command Help
Replies: 1
Views: 47

Re: DOS Command Help

Just a quick hint. For the first question, have a look at the documentation of the where command. For the second have a look at the documentation of for /r.

https://ss64.com/nt/where.html

https://ss64.com/nt/for_r.html
by atfon
13 Oct 2021 14:01
Forum: DOS Batch Forum
Topic: Open next menu in programm
Replies: 9
Views: 530

Re: Open next menu in programm

There is this post that discusses how to use wscript send keys for this and wrap it in a batch script:

viewtopic.php?t=4758
by atfon
13 Oct 2021 08:18
Forum: DOS Batch Forum
Topic: Create Local User and add to local admin group
Replies: 2
Views: 224

Re: Create Local User and add to local admin group

net localgroup Administrators ADMIN2 /add My code performs the first two lines, but does not add the the user to the local administrators group. This is probably something very simple. Thanks for the help in advance :) Your command for net localgroup "looks" correct. Can you run that from the comma...
by atfon
05 Oct 2021 13:05
Forum: DOS Batch Forum
Topic: Funny Windows 11 Non-Glitch
Replies: 7
Views: 545

Re: Funny Windows 11 Non-Glitch

Squashman wrote:
05 Oct 2021 12:52
aGerman wrote:
05 Oct 2021 12:45
The difference is that it shows up in a console window with round corners :lol:
I draw the line on round corners. Never upgrading to Windows 11!!
Maybe write a script that converts round corners to square? :wink:
by atfon
05 Oct 2021 11:28
Forum: DOS Batch Forum
Topic: Sum of two decimal values
Replies: 5
Views: 407

Re: Sum of two decimal values

What exactly do you mean by string manipulation to recover the decimal point? Thanks Mark Hello Mark. You can extract the first digit and the last digit: https://www.dostips.com/DtTipsStringManipulation.php#Snippets.LeftString For the first digit, set "first=%str:~-1%" and for the last set "last=%s...
by atfon
05 Oct 2021 09:56
Forum: DOS Batch Forum
Topic: Sum of two decimal values
Replies: 5
Views: 407

Re: Sum of two decimal values

The command processor has a limitation when it comes to floating point arithmetic. Have a look at this workaround:

https://www.dostips.com/DtTipsArithmeti ... atingPoint

Note: You can get your decimal back with string manipulation on the result.
by atfon
04 Oct 2021 10:30
Forum: DOS Batch Forum
Topic: user name
Replies: 25
Views: 1379

Re: user name

As a quick tip, this will get you a list of volume drive letters on their size in bytes on a given system:

Code: Select all

wmic logicaldisk get name, size
You can find other posts on this forum about converting from bytes to gigabytes.
by atfon
29 Sep 2021 11:52
Forum: DOS Batch Forum
Topic: How to get READONLY Status for Current disk drive (usb) - like diskpart/attr disk
Replies: 15
Views: 932

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

I can't run in it on Windows 10 without admin rights. I was reviewing some old posts and I believe the reason Steffen uses net session in the info.bat script on this forum is due to fsutil no longer requiring Admin rights: https://www.dostips.com/forum/viewtopic.php?p=49172#p49172 I wonder if this ...
by atfon
29 Sep 2021 08:16
Forum: DOS Batch Forum
Topic: How to get READONLY Status for Current disk drive (usb) - like diskpart/attr disk
Replies: 15
Views: 932

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

You need to run it as Administrator Not on Windows 10. You did previously on Windows 7. Interesting. Microsoft should really update their documentation: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/fsutil You must be logged on as an administrator or a member of th...
by atfon
29 Sep 2021 06:14
Forum: DOS Batch Forum
Topic: How to get READONLY Status for Current disk drive (usb) - like diskpart/attr disk
Replies: 15
Views: 932

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

It can be a bit of a pain to script for diskpart as it requires an external file. I would suggest fsutil. You need to run it as Administrator, but you can capture Read/Write or Read Only information for a drive. For example: fsutil fsinfo volumeinfo C: https://docs.microsoft.com/en-us/windows-server...
by atfon
29 Sep 2021 06:03
Forum: DOS Batch Forum
Topic: display time in 12 hr
Replies: 25
Views: 12910

Re: display time in 12 hr

I don't know about the bug you mentioned, so the following might or might not ne usefull. In my experience a changing offset is caused by the "Set Time Zone Automatically" feature, which is realized by an informed guessing of your current geolocation; see: https://docs.microsoft.com/en-us/uwp/api/W...
by atfon
28 Sep 2021 12:35
Forum: DOS Batch Forum
Topic: display time in 12 hr
Replies: 25
Views: 12910

Re: display time in 12 hr

A workaround I can see is comparing the UTC Offset from wmic os get localdatetime to either the lastboottime setting or the Registry for /f "tokens=2 delims=-" %%g in ('wmic os get lastbootuptime') do for /f "tokens=1" %%h in ("%%g") do set "utcOffset=%%h" or for /f "tokens=3" %%a in ('reg query "HK...
by atfon
28 Sep 2021 09:03
Forum: DOS Batch Forum
Topic: display time in 12 hr
Replies: 25
Views: 12910

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. No worries. It seems to change randomly. A search of the internet revealed this to be a more common problem than I realized. It seems that the wmic os get localdatetim...
by atfon
28 Sep 2021 08:39
Forum: DOS Batch Forum
Topic: display time in 12 hr
Replies: 25
Views: 12910

Re: display time in 12 hr

Compo wrote:
28 Sep 2021 08:38
Yes, you've changed your settings between both of those examples!
Actually, no I have not. See the Edit in my answer above.
by atfon
28 Sep 2021 08:12
Forum: DOS Batch Forum
Topic: display time in 12 hr
Replies: 25
Views: 12910

Re: display time in 12 hr

I've noticed some strange periodic behavior with the "wmic os get localdatetime" command. From time to time, it is showing an hour behind the system time. Here I have set the prompt to display the time and then issued the wmic command: prompt $t $g 10:04:18.63 >wmic os get localdatetime LocalDateTim...