Search found 178 matches

by Simon Sheppard
2023-May-30, 10:51 pm
Forum: Windows CMD Shell
Topic: from a filename to file paths
Replies: 10
Views: 12018

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: 4365

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: 4626

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: 4626

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: 2256

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: 10
Views: 28006

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: 13391

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: 10
Views: 28006

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...
by Simon Sheppard
2023-Mar-03, 10:59 pm
Forum: Windows PowerShell
Topic: Mapping Accessible Network Shares via Powershell
Replies: 1
Views: 11237

Re: Mapping Accessible Network Shares via Powershell

There isn't quite enough info in your question to give much advice, it really depends how you have structured all the file shares.

If you turn on Access-based Enumeration then you can just map one level and the sub folders will automatically appear if the user has permission to them.
by Simon Sheppard
2023-Mar-02, 9:09 am
Forum: Windows CMD Shell
Topic: Is there any way to modify a variable twice in the same IF comparison?
Replies: 7
Views: 7309

Re: Is there any way to modify a variable twice in the same IF comparison?

Hello Hello There Is exactly what i would expect to get because you are not using delayed expansion, so everything within the brackets is treated like a single line as far as variable expansion goes. You can SET variables, but reading them will get the value as evaluated at the start of the code bl...