Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed last year.
Improve this question
I'm trying to adapt this script that is called through a contextual menu:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\RenameWithTimestamp]
#="Rename: Add Date Modified"
[HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\RenameWithTimestamp\Command]
#="PowerShell.exe -WindowStyle Hidden -Command \"( Get-Item -LiteralPath '%1' ) | %%{ Rename-Item -LiteralPath $_.FullName -NewName ( '{0:yyyyMMdd_HHmmss} {1} {2}' -f $_.LastWriteTime,$_.BaseName, $_.Extension ) }\""
I would like to be able to execute this PowerShell script without right click contextual menu, only select the files and then launch the script that rename the selected files. Any idea?
Related
Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 days ago.
Improve this question
I have folders C:\Example\Project1, C:\Example\Project2, C:\Example\Project3, etc.
Inside some of those project folders are subfolders called OLD, so for example C:\Example\Project1\OLD
I'd like to move all those OLD subfolders to a new root folder C:\ExampleOLD so they would have a structure like C:\ExampleOLD\Project1\OLD, C:\ExampleOLD\Project2\OLD, etc.
How can I do this with robocopy or any other tool that comes with windows 10?
With Powershell... Please accept as answer. Best regards~
Get-ChildItem -Path "C:\Example" -Include "OLD" -Directory -Recurse -Force | Move-Item -Destination "C:\ExampleOLD" -Force
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
Whenever I run command prompt, it works fine but is not showing the current directory before the prompt(blinking).How can this be solved?
1.) Open up registry editor by typing "regedit" [without the quotes] in the search box, and then clicking on the link up top.
2.) Navigate to the key HKEY_CURRENT_USER \ Software \ Microsoft \ Command Processor and search for the string "Autorun" in the left window. If that string is not existing yet, create it. Double-click it afterwards and add the new directory path in the following way: CD /d C:\
3.) If you would like the command prompt to open in the system32 folder, use this string instead:
CD /d C:\windows\system32
It solved mine!
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
The community reviewed whether to reopen this question last year and left it closed:
Original close reason(s) were not resolved
Improve this question
There is a file (abc.txt) in a folder-
C:\vackwrk\24may\abc.txt
and i want to copy that file to another folder using cmd-
G:\work\
I use copy C:\vackwrk\24may\abc.txt G:\work\
this work , but when i am using wildcard it don't work copy C:\vackwrk\*\abc.txt G:\work\ this time output is - The filename , directory name or volume label syntax is incorrect.
Why ? Is there any alternate way to copy using wildcard ?
There is no way to use wildcard while copying from cmd because there will be ambiguity to system if there is any other directory C:\vackwrk\foo\ and C:\vackwrk\bar\,both with a file abc.txt.
But Windows PowerShell lets you to do copy using wildcard very easily , just need to open cmd and enter start powershell.exe copy C:\vackwrk\*\abc.txt G:\work\ or simply open Windows PowerShell and enter PS C:\Windows\system32> copy C:\vackwrk\*\abc.txt G:\work\ .
It works fine , so i think Windows PowerShell is more powerful than cmd.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I am using a remote windows server and I have access to only windows power shell. I need to find path of few directories. Is there any way to locate files/directories in windows power shell.
Thank You
I got the solution, the command is
C:\> get-childitem -recurse -include *directory-name*
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I use windows 7 64bit. I found both cmd.exe and powershell cannot keep history. It means it lost my command history when I quit the shell.
Is there a tools can help cmd.exe or powershell to remember the history? I try to use console 2. Console 2 is tiny and has a tab interface. But console 2 can't remember the history too. Maybe there is another front end can do this.
The answer below is from Keith Hill (PowerShell Microsoft MVP) in his answer to the question powershell history: how do you prevent duplicate commands:
BTW if you want to automatically save this on exit you can do this on 2.0 like so:
Register-EngineEvent PowerShell.Exiting {
Get-History -Count 32767 | Group CommandLine |
Foreach {$_.Group[0]} | Export-CliXml "$home\pshist.xml" } -SupportEvent
Then to restore upon load all you need is:
Import-CliXml "$home\pshist.xml" | Add-History
There's an excellent post on the Windows PowerShell Blog that provides a way of preserving command history across sessions:
http://blogs.msdn.com/b/powershell/archive/2006/07/01/perserving-command-history-across-sessions.aspx
The pertinent commands for exporting and importing the command history are Get-History and Add-History. Add the following to your PowerShell profile:
Register-EngineEvent PowerShell.Exiting {
Get-History | Export-Csv $HOME\pshist.csv
} | Out-Null
if (Test-Path $Home\pshist.csv) {
Import-Csv $HOME\pshist.csv | Add-History
}
This will preserve the history in such a way that you can still inspect the history for start and end times, and calculate the duration of each.
A warning though: The above script will only remember the history of the most recently exited PowerShell window. If you work with multiple shell sessions at the same time, then the history of all but one of them will be lost.