Windows 10 How to recursively remove all PRG and P00 file extensions? E.g. in batch

MIRKOSOFT

New Member
Hello!

I need to recursively to remove all extensions PRG and P00 on single partition.
I know that recursively can work XCOPY, but renaming is other task.
How to create batch to remove all these extensions of files and folders (if exist) recursively?

Thank you for each help, suggestion or reply and comments.
Miro
 

MIRKOSOFT

New Member
Great!
Only last Q - how to execute PowerShell script by command without opening PS console?

Thank you very much.
Miro
 

Neemobeer

Windows Forum Team
Staff member
You need to make sure your execution policy will allow powershell scripts Set-ExecutionPolicy -Scope MachinePolicy -ExecutionPolicy RemoteSigned then you should be able to just run a script by right clicking it and say "Run with Powershell"
 

MIRKOSOFT

New Member
Policy I know that needs to allow.
I mean not execution by right click from menu.
Really command which can be used as submenu in context menu directly starting script, like BAT or CMD has batches - similar way.
Anything like
\CLASSES_ROOT\*\SHELL\Remove Extensions\command\(Default)...
...execute.bat "%1"
and so on...

Miro
 

MIRKOSOFT

New Member
Ok, finally - how to create PowerShell batch or embed PS batch (lines with PS code) into BAT or CMD?

Thank you for both answers.
Miro
 

MIRKOSOFT

New Member
Ok, how to embed whole script - this code:

Code:
$FilePath = $args[0]

$Filename = Split-Path -Path $FilePath -Leaf
$Content = Get-Content -Path "$FilePath" | Out-String
$MeasuredData = Measure-Object -InputObject $Content -Line -Word -Character

$FormattedOutput = "Extension $($FileName): Words: $($MeasuredData.Words) Lines: $($MeasuredData.Lines) Chars: $($MeasuredData.Characters)"

[System.Windows.Forms.MessageBox]::Show($FormattedOutput)
 
Top