Search found 87 matches

by Simon Sheppard
2022-Aug-05, 2:50 pm
Forum: Windows CMD Shell
Topic: How to replace all characters in a variable with another character?
Replies: 2
Views: 81

Re: How to replace all characters in a variable with another character?

If this is to represent a password, it is worth considering do you really need to represent the right number of characters? Hiding the length of a password is generally good security, then you can just display a fixed line of *******'s OTOH if this is something like a username or email address, then...
by Simon Sheppard
2022-Jul-20, 7:14 pm
Forum: Windows CMD Shell
Topic: Double Quotes embedded in Double Quotes
Replies: 3
Views: 101

Re: Double Quotes embedded in Double Quotes

OK that's done, I also added a couple of alternatives :)
by Simon Sheppard
2022-Jul-18, 8:03 pm
Forum: Windows CMD Shell
Topic: "call exit" - Exit batch file from call subroutine
Replies: 3
Views: 159

Re: "call exit" - Exit batch file from call subroutine

PiotrMP006 wrote: 2022-Jul-18, 6:54 am
Both options are described here: https://ss64.com/nt/call.html
The "call exit" solution is not described here "https://ss64.com/nt/call.html" !!!
It is described in the section:
CALL a subroutine (:label)
by Simon Sheppard
2022-Jul-17, 1:35 pm
Forum: Windows CMD Shell
Topic: "call exit" - Exit batch file from call subroutine
Replies: 3
Views: 159

Re: "call exit" - Exit batch file from call subroutine

I tend to use Goto :eof

Both options are described here: https://ss64.com/nt/call.html
by Simon Sheppard
2022-Jul-03, 1:28 pm
Forum: Windows PowerShell
Topic: Data missing when Select-Object in use
Replies: 5
Views: 356

Re: Data missing when Select-Object in use

Ah I see what you mean.

I think this is one of those annoying cases where the columns have a 'display name' to prettify the output.

To get the real property names you can select/filter on, you need to do:

Code: Select all

Get-DnsClientCache | Format-List -Property * -Force
by Simon Sheppard
2022-Jul-03, 10:32 am
Forum: Windows PowerShell
Topic: Data missing when Select-Object in use
Replies: 5
Views: 356

Re: Data missing when Select-Object in use

This is standard behaviour when you ask PowerShell for more data than will fit across the screen. Solutions: 1) Just make the window wide enough so it will fit. 2) Pipe the output to | format-table -auto (this may still truncate but it will try a bit harder to display everything). 3) Send the output...
by Simon Sheppard
2022-Jun-27, 4:40 pm
Forum: Windows CMD Shell
Topic: doskey /reinstall
Replies: 1
Views: 197

Re: doskey /reinstall

Looks like that bug has been around for quite a while
a workaround is

Code: Select all

rem Clear the command history
doskey /LISTSIZE=0
doskey /LISTSIZE=50
via https://www.dostips.com/forum/viewtopic.php?f=3&t=5661
by Simon Sheppard
2022-Jun-26, 1:56 pm
Forum: Windows CMD Shell
Topic: variable character replace
Replies: 2
Views: 190

Re: variable character replace

Try like this @echo off set _string=abc set _char=a call set _out=%%_string:%_char%=%% echo [%_out%] if %_string%==%_out% (echo Char %_char% not present) else (echo Char %_char% present) So in the CALL SET line, the outer %'s have to be doubled because we are using CALL, the _string variable doesn't...
by Simon Sheppard
2022-Jun-13, 2:17 pm
Forum: Windows CMD Shell
Topic: wmic diskdrive command invalid query
Replies: 2
Views: 242

Re: wmic diskdrive command invalid query

instead of wmic diskdrive getName ...
try wmic diskdrive get Name ...
by Simon Sheppard
2022-Apr-22, 9:03 pm
Forum: Windows VBScript
Topic: Arguments are overriden when using Drag&Drop
Replies: 1
Views: 455

Re: Arguments are overriden when using Drag&Drop

My first thought would be to add a batch file, drag a file onto the batch file,which then calls the VBScript using cscript.exe passing whatever arguments you want, which could include %* for the dropped filename(s).