- Thread Author
-
- #1
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
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
Solution
You don't need to. Just call powershell.exe -command " & { <command> }"
- Joined
- Jul 4, 2015
- Messages
- 8,998
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"
- Thread Author
-
- #5
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
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
- Thread Author
-
- #11
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)
Similar threads
- Featured
- Article
- Replies
- 1
- Views
- 223
- Featured
- Article
- Replies
- 0
- Views
- 203
- Replies
- 0
- Views
- 561
- Featured
- Article
- Replies
- 0
- Views
- 409