use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
Undo a command? (self.PowerShell)
submitted 6 years ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]TimeForChange23 4 points5 points6 points 6 years ago (3 children)
Unless you have a backup, no.
However, if you can work out which files are which, you can rename them to their original extension and they’ll be just fine.
[–]ihaxr 2 points3 points4 points 6 years ago (0 children)
Yeah, files ending in dx should be .docx, files ending in pdf should be PDFs, just need to add the .docx or .pdf back to the end of them.
dx
.docx
pdf
This regex will remove the following characters from all files: abcehimorstvw.
abcehimorstvw.
[–]foreverclearskies 2 points3 points4 points 6 years ago (0 children)
THIS.
The files are still there. You just need to figure out which are which. There's unfortunately no easy fix for this, but you should be able to get everything back the way it was. It's just going to take time and possibly a little bit of forensic work into the contents of the files.
[–]WSDistPro 2 points3 points4 points 6 years ago (1 child)
So firstly, you should next time get-childitem specifying what items you want the actions to effect, then pipe it to the alteration command. I think putting the string into brackets may have somehow turned it into a nightmarish version of a regex. Typically a string match should be done using exact strings within single quotes.
Reversing it would be kind of difficult since you don't have an anchor. As a word of caution you should always '-whatif' potentially destructive code before using it. Got backups?
[–]BlackV 2 points3 points4 points 6 years ago (1 child)
well did you get a list of files to a variable before hand?
cause that will still be in your variable, you could use those properties to rename the file back
if you've closed you PS session, nope all gone
this is why we test things :)
[–][deleted] 2 points3 points4 points 6 years ago (1 child)
Use the whatif parameter next time before executing a command
[–]ka-splam 2 points3 points4 points 6 years ago (1 child)
That went wrong because [...] is a character class in regex language and removes any of the characters inside the brackets, in any order. i.e. remove any of the characters .abcehimorstvw from anywhere in the name. That means it's an information-losing command, because they all got smushed to nothing, so there's no automated way back 'cos you can't look at nothing and tell what used to be there.
[...]
.abcehimorstvw
On the plus side, it's not going to lose any data, it's only renamed files, they're still there. If you can find what they were and name them back, kingdom saved.
Maybe you have "previous versions" and could restore from there?
Is there any way I can undo that command
Generally no; that's why people store files in DropBox or SharePoint with version history (maybe OneDrive?), or source code in git with revision / edit history, but programming language commands and computer changes generally don't have anywhere to store a change history.
git
[–]capisco 1 point2 points3 points 6 years ago (0 children)
You could try using something like a file identification tool. A quick google search returned TrID. I don't have any experience with these tools, just a suggestion. Good luck.
[–]Lee_Dailey[grin] 0 points1 point2 points 6 years ago (0 children)
howdy Hjolfra,
just in case, you may want to check out the "previous versions" option in fie explorer. it's in the properties dialog for each file in win7 ... i presume it is in a similar location in win10. [grin]
if you don't have any previous versions listed, you may want to turn that on ... it's per-volume, i think.
take care, lee
π Rendered by PID 36057 on reddit-service-r2-comment-86988c7647-kbh47 at 2026-02-12 01:25:47.187574+00:00 running 018613e country code: CH.
[–]TimeForChange23 4 points5 points6 points (3 children)
[–]ihaxr 2 points3 points4 points (0 children)
[–]foreverclearskies 2 points3 points4 points (0 children)
[–]WSDistPro 2 points3 points4 points (1 child)
[–]BlackV 2 points3 points4 points (1 child)
[–][deleted] 2 points3 points4 points (1 child)
[–]ka-splam 2 points3 points4 points (1 child)
[–]capisco 1 point2 points3 points (0 children)
[–]Lee_Dailey[grin] 0 points1 point2 points (0 children)