Search found 127 matches

by Simon Sheppard
2023-Jun-01, 4:30 pm
Forum: Windows CMD Shell
Topic: Automatically apply the current working path as a title to the command line window.
Replies: 2
Views: 29

Re: Automatically apply the current working path as a title to the command line window.

If you go into the registry HKCU\Software\Microsoft\Command Processor\ Create a new string value called: AutoRun set it to: TITLE %cd% That will set the title of each new CMD window (wherever it is opened from) to the current directory when opened, just be aware that if you change directory the titl...
by Simon Sheppard
2023-May-30, 11:03 pm
Forum: Windows PowerShell
Topic: from a filename to file paths
Replies: 1
Views: 248

Re: from a filename to file paths

Code: Select all

CD C:\Doc\
$files = get-content files.txt
foreach ($file in $files) {dir $file -recurse | select -expandProperty fullname | out-file -append -encoding utf8 C:\demo\result.txt}
This is assuming the current directory is the start point for the search.
by Simon Sheppard
2023-May-30, 10:51 pm
Forum: Windows CMD Shell
Topic: from a filename to file paths
Replies: 3
Views: 157

Re: from a filename to file paths

If you just have a small number of files, you can do what Simon_Weel suggests and hard code the filenames: dir newdoc2023.docx /s /b >result.txt dir document_34.docx /s /b >>result.txt etc If you have a lot of files then you will want to automate reading the filenames in a loop: @echo off for /f %%G...
by Simon Sheppard
2023-May-17, 5:06 pm
Forum: Windows CMD Shell
Topic: quick check of the new things on win11..
Replies: 1
Views: 102

Re: quick check of the new things on win11..

Thanks for this npocmaka , Windows subsystems for linux is a bit of a surprise, a few years ago it looked like they were just going to drop that.
by Simon Sheppard
2023-May-10, 7:43 pm
Forum: Windows CMD Shell
Topic: Function to Sanitize User Input
Replies: 2
Views: 107

Re: Function to Sanitize User Input

Hi Jeb, welcome to the forum :D You raise a good point, its probably better to not echo the original input string at all, thats just asking for trouble. I think it is always going to be necessary to filter out a couple of the more obvious poison characters and then use the function to remove everyth...
by Simon Sheppard
2023-May-05, 4:45 pm
Forum: Windows CMD Shell
Topic: Function to Sanitize User Input
Replies: 2
Views: 107

Function to Sanitize User Input

Heres a function that can be fed a string and will strip out all characters not in a pre-defined list. Intended to be used with any user-supplied data, i.e. SET /P @ECHO OFF Setlocal :: Name: Michael Wright/Simon Sheppard :: Date: 2023-05-05 :: Desc: sanitize function :: Sanitize an input string omi...
by Simon Sheppard
2023-Mar-20, 12:20 pm
Forum: Windows CMD Shell
Topic: For loops: Is there any reason you HAVE to use different tokens?
Replies: 1
Views: 658

Re: For loops: Is there any reason you HAVE to use different tokens?

Using extra characters is not about nesting, but about having the option to use more than 26 TOKENS, so for example you might want to parse some data out of a CSV file with more than 26 columns. Each FOR command instantiates a new instance in memory which inherits all the variables of the parent pro...
by Simon Sheppard
2023-Mar-20, 12:10 pm
Forum: Windows CMD Shell
Topic: Use SED to extract part of a line?
Replies: 8
Views: 2551

Re: Use SED to extract part of a line?

Nice solution :)
by Simon Sheppard
2023-Mar-19, 12:38 pm
Forum: General Tech News, Notes and Queries
Topic: Edit a Windows 11 setting using batch
Replies: 1
Views: 1175

Re: Edit a Windows 11 setting using batch

Most of these settings can be found in the registry e.g. HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\PrecisionTouchPad 32-Bit DWORD value AAPThreshold . 0 = Most sensitive 1 = High sensitivity 2 = Medium sensitivity (default) 3 = Low sensitivity So first I would look at that in reged...
by Simon Sheppard
2023-Mar-12, 1:48 pm
Forum: Windows CMD Shell
Topic: Use SED to extract part of a line?
Replies: 8
Views: 2551

Re: Use SED to extract part of a line?

SED is a stream editor intended to modify a files contents rather than extracting values from it. if you want to use bash utilities, I would start by using head and tail to extract just line 35. Then when you have that single line, use grep to extract the part you need. If you want to do this in nat...