Search found 130 matches

by Simon Sheppard
2023-Jun-05, 9:21 pm
Forum: Windows PowerShell
Topic: from a filename to file paths
Replies: 5
Views: 298

Re: from a filename to file paths

See How-to: Run a PowerShell script
https://ss64.com/ps/syntax-run.html
by Simon Sheppard
2023-Jun-05, 4:54 pm
Forum: Windows CMD Shell
Topic: from a filename to file paths
Replies: 6
Views: 220

Re: from a filename to file paths

You may have to adjust the filenames to match what you have.
by Simon Sheppard
2023-Jun-05, 4:53 pm
Forum: Windows PowerShell
Topic: from a filename to file paths
Replies: 5
Views: 298

Re: from a filename to file paths

PowerShell can be run from a .PS1 script or directly at the command line, just adjust the filenames to match what you have.
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: 39

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: 5
Views: 298

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: 6
Views: 220

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

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

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

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

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...