You could probably modify this function (function Test-KeyPress) to get that behaviour:
https://powershell.one/tricks/input-dev ... -key-press
Search found 153 matches
- 2023-Aug-31, 6:41 pm
- Forum: Windows PowerShell
- Topic: Closing a PowerShell window with other keys [SOLVED]
- Replies: 2
- Views: 3022
- 2023-Aug-26, 9:30 pm
- Forum: Windows PowerShell
- Topic: Get-DnsClientCache converts/displays an integer for RecordType
- Replies: 1
- Views: 3057
Re: Get-DnsClientCache converts/displays an integer for RecordType
Getting sensible values out of this was harder than I expected, they are both hard coded and in [uint16] so you will need something like this: # Hash table of Types $dnstypes = @{ [uint16]1 = "A" [uint16]2 = "NS" [uint16]5 = "CNAME" [uint16]6 = "SOA" [uint16]1...
- 2023-Aug-25, 6:55 pm
- Forum: Windows CMD Shell
- Topic: PUSHD example logic inverted
- Replies: 3
- Views: 3170
Re: PUSHD example logic inverted
Thanks all, fixed now
- 2023-Aug-16, 4:54 pm
- Forum: Windows CMD Shell
- Topic: How to remove trailing backslash from %*
- Replies: 7
- Views: 3235
Re: How to remove trailing backslash from %*
The IF command can seem flaky if any spaces exist in the comparison strings. for example these 3 commands all seem to work OK IF '~a'=='~ a' Echo OK IF [~a]==[~ a] Echo OK IF "~a"=="~ a" Echo OK But if you reverse the logic to see if they are not equal IF '~a' NEQ '~ a' Echo OK I...
- 2023-Aug-14, 12:21 am
- Forum: Windows CMD Shell
- Topic: How to remove trailing backslash from %*
- Replies: 7
- Views: 3235
Re: How to remove trailing backslash from %*
From an answer on superuser.com I got this, which removes trailing backslashes from a variable: IF %datapath:~-1%==\ SET datapath=%datapath:~0,-1% Whatever I try, I cannot get it work with `%*` instead of `%datapath%`. Is there any way I can do this? Alternatively, I believe adding a trailing dot a...
- 2023-Aug-03, 5:40 pm
- Forum: Windows CMD Shell
- Topic: For /F - Tokens has me puzzled
- Replies: 6
- Views: 3177
Re: For /F - Tokens has me puzzled
Nice, may I suggest a few additions / changes? Thanks I'd never really considered listing the tokens in descending order. A slightly modified version of your example @echo off for /f "tokens=3,2,1,*" %%A in ("alpha beta gamma delta epsilon") do echo A:%%A B:%%B C:%%C D:%%D Outpu...
- 2023-Aug-03, 9:33 am
- Forum: Windows CMD Shell
- Topic: For /F - Tokens has me puzzled
- Replies: 6
- Views: 3177
Re: For /F - Tokens has me puzzled
From the for/f page: tokens=* will cause all items on each line to be processed. tokens=3* will process the third token and the 4th + all subsequent items, this can also be written as tokens=3,* Each token specified will cause a corresponding parameter letter to be allocated. The letters used for t...
- 2023-Aug-02, 5:00 pm
- Forum: Windows CMD Shell
- Topic: How to get user details out of Active Directory?
- Replies: 2
- Views: 3061
Re: How to get user details out of Active Directory?
If you don't want to install RSAT, then I would use VBScript, heres a sample script you can modify to return other properties:
Search
https://ss64.com/vb/syntax-ad.html
for current user
https://ss64.com/vb/syntax-userinfo.html
LDAP properties
https://ss64.com/ps/syntax-ldap.html
Search
https://ss64.com/vb/syntax-ad.html
for current user
https://ss64.com/vb/syntax-userinfo.html
LDAP properties
https://ss64.com/ps/syntax-ldap.html
- 2023-Jul-28, 8:54 pm
- Forum: Windows CMD Shell
- Topic: Output of %TIME% and Time/ T is region dependent
- Replies: 0
- Views: 3052
Output of %TIME% and Time/ T is region dependent
Over on the TIME page I have documented the output of TIME for a few regions, those were correct in 2018 but I am getting some reports that this output has changed for some regions in recentish builds of Windows 10 and 11. It any of you have TIME output which differ do post them here and I'll update...
- 2023-Jul-27, 11:43 am
- Forum: Windows CMD Shell
- Topic: Does "endlocal" close all instances of "setlocal"?
- Replies: 6
- Views: 3248
Re: Does "endlocal" close all instances of "setlocal"?
I'm just curious: How many of you use setlocal by itself and not paired with enabledelayedexpansion, or enableextensions? I start every script with @echo off setlocal Just as a matter of habit, even for scripts which don't (yet) contain any variables. If you run a script from a CMD session and it s...