Search found 58 matches

by Simon Sheppard
2022-Jan-15, 8:03 pm
Forum: Windows CMD Shell
Topic: stampme.cmd anyway to make it use 2 digit month and day and am/pm
Replies: 1
Views: 371

Re: stampme.cmd anyway to make it use 2 digit month and day and am/pm

WMIC has now been deprecated, it does still work for now but who knows how much longer it may last.

So I have re-written the StampMe example page so that it now uses Robocopy, based on npocmaka's script on StackOverflow.
by Simon Sheppard
2022-Jan-12, 11:16 pm
Forum: General Tech News
Topic: Windows Terminal to become the Default in Windows 11
Replies: 0
Views: 37

Windows Terminal to become the Default in Windows 11

Over the course of 2022, we are planning to make Windows Terminal the default experience on Windows 11 devices. We will start with the Windows Insider Program and start moving through rings until we reach everyone on Windows 11. - Windows Command Line Blog
by Simon Sheppard
2022-Jan-02, 1:42 am
Forum: Windows CMD Shell
Topic: Using the Windows port of SED?
Replies: 1
Views: 127

Re: Using the Windows port of SED?

The GnuWin32 version of sed only supports double quotes, because thats all the CMD shell understands.

Code: Select all

sed "s/test/text/" test.txt
An alternative would be to run Cygwin, which is more like a Unix shell so I think it gives you more quoting options.
by Simon Sheppard
2021-Dec-20, 8:11 pm
Forum: Windows PowerShell
Topic: prepend each object
Replies: 2
Views: 199

Re: prepend each object

Hi querty That can be done using the Subexpression operator inside a string . $objects = systeminfo.exe /FO CSV 2>&1| ConvertFrom-Csv; $objects.'Total Physical Memory'; $objects.'Available Physical Memory'; $objects.'Virtual Memory: Max Size'; $objects.'Virtual Memory: Available'; $objects.'Virt...
by Simon Sheppard
2021-Dec-17, 8:10 pm
Forum: Windows CMD Shell
Topic: CMD Random
Replies: 2
Views: 151

Re: CMD Random

When you divide %RANDOM% by 32768 you will get a random number between 0 and almost 1 (0.999969) notice we are dividing by 327 68 rather than 32767, so we should never get 1 which would give us an uneven distribution of numbers. if you multiply that by 6 you will get a random number between 0 and 5....
by Simon Sheppard
2021-Dec-17, 1:01 am
Forum: Meta: Site Feedback / Forum Q&A
Topic: Comments by first time visitor man (date)
Replies: 1
Views: 186

Re: Comments by first time visitor man (date)

I'm not sure adding a date would really help much with this, there are so many differences across different distributions the only way to be sure is to run the man command and compare the options for yourself.
by Simon Sheppard
2021-Dec-10, 11:59 am
Forum: Windows CMD Shell
Topic: File Directory Redirection with appended text
Replies: 1
Views: 146

Re: File Directory Redirection with appended text

In PowerShell $files = dir c:\filepath\*.trn $files | foreach-object {echo "RESTORE LOG [dbName] FROM DISK =' $_.name ' WITH NORECOVERY"} In CMD FOR /f %%G in ('dir /b c:\filepath\*.trn') do echo RESTORE LOG [dbName] FROM DISK =' %%G ' WITH NORECOVERY In both cases you can redirect the out...
by Simon Sheppard
2021-Dec-08, 1:39 am
Forum: Windows CMD Shell
Topic: Seeking one-line output: filename plus hash
Replies: 4
Views: 207

Re: Seeking one-line output: filename plus hash

PowerShell should be capable of doing this without any other utilities, see these two cmdlets:

https://ss64.com/ps/get-filehash.html
https://ss64.com/ps/export-csv.html

If you can write batch files, PowerShell is much easier to pick up - the only hard part is remembering all the different cmdlets.
by Simon Sheppard
2021-Nov-26, 4:17 pm
Forum: Windows PowerShell
Topic: PowerShell script to open Settings (control panel)
Replies: 0
Views: 400

PowerShell script to open Settings (control panel)

This simple script displays a text menu and then opens your selection of Settings (control panel) https://ss64.com/ps/syntax-settings.html The script works but I feel like there may be a less verbose way of writing it, perhaps with a hash table. Also it would be good if the first menu option could a...