Forums
For updating folder dates, the utility "FolderTimeUpdate" can be used (developed by NirSoft).
Search-words: bat cmd batch script
- Log in to post comments
For updating folder dates, the utility "FolderTimeUpdate" can be used (developed by NirSoft).
Search-words: bat cmd batch script
Comments
CMD-script to create logfile with date-time (yyMMdd-hhmmss)
Script below is a sample of calling another CMD-file and redirecting screen output (including errors) to a logfile with current time.
cmd/bat-file to search and replace in filename
The batch-script below can be used to rename files, it will ask for search and replace strings.
Powershell Tips
Cross-platform Powershell:
https://aka.ms/pscore6
Powershell - Search folder and remove XML-element in files
The Powershell-script below can be used to search for and remove an XML-element from all XML-files in chosen folder.
Running the script it will ask for folder and name of XML-element.
Default value for XML-element is "sheetProtection" as it primary use was to remove sheet-passwords in Excel-documents.
(rename xlsx-files to "zip", extract zip into folder, and then use powershell-script on folder ".\xl\worksheets"
Suggested name for powershell-file: "remove-xml-elem.ps1"
Search-words: excel powershell
Simple Powershell-script…
Simple Powershell-script that will create a log file with current date and time.
Start KeepassXC w elevated admin priveliges using Task Scheduler
Try using the command below to create a Scheduled Task that will run "on logon":
(Use XML-sample below instead, as this will stop when running a laptop on battery..)
Show info for scheduled task with name "keepassxc-elevated":
Delete a scheduled task:
Register scheduled task using XML:
Sample-XML for the file "keepassxc-startup.xml":
List every startup app in Windows (Powershell)
Use script below to get a list of all startup applications in Windows:
Get the list in a "grid":
https://www.makeuseof.com/powershell-command-startup-app-windows-doesnt-show/
Show processes listed by memory use (Powershell)
Processes by memory use, sorted descending:
List all code files in a VS-solution (generate questions to AI)
Powershell-script that will list all code-files in a Visual Studio solution.
Useful for generating questions to AI regarding folder/file-structure.
Enable long paths (exceeding 260 characters)
Powershell-script below can be used to set registry setting that enables "long paths".
(Make sure to start PowerShell with elevated admin privileges)
Useful when code repositories (in TFVC or GIT) might run in to issues, and Visual Studio might complain.
Restart the computer after the script has been run.
Start elevated PowerShell-window from existing cmd-window
One-liner to start a new elevated PowerShell-window with the same path as existing command-window (existing can be either Windows old terminal or PowerShell).
Created with help from ChatGpt :-)