Archive for the ‘Batch-Files’ Category
Posted by jpluimers on 2025/10/07
That feeling you have been living under a stone since 2014: [Wayback/Archive] finding duplicates – voidtools forum
1.4 Beta has both dupe: & sizedupe: functions.
(In the Index, you need to index the file size & also enable Fast size sort.)
You can combine them, something like:
> dupe: sizedupe: c: file:
Or even add a size to it:
> dupe: sizedupe: c: file: size:>2MB
Note that that finds file name AND (I believe its an AND) file size duplications – anywhere, not necessarily limited to C:, & also that name AND size are the only qualifications for “duplication”, as in files meeting that criteria may not be (byte-by-byte) “duplicates”.
A partial excuse is that these never made it to the changelog at [Wayback/Archive] www.voidtools.com/Changes.txt or [Wayback/Archive] www.voidtools.com/BetaChanges.txt.
It is in the documentation since May 2017 at [Wayback/Archive] Searching – voidtools though:
Read the rest of this entry »
Posted in Batch-Files, Development, Everything by VoidTools, Power User, Scripting, Software Development, Windows | Leave a Comment »
Posted by jpluimers on 2025/09/02
For a long time, I have ran with the runelevated.bat in [Wayback/Archive] Run an Elevated command using that: “net file” returns errorlevel 1 when not UAC, and “PowerShell Start-Process” has a “-Verb RunAs“; see the answers at http://stackoverflow.com/questions/7044985/how-can-i-auto-elevate-my-batch-file-so-that-it-requests-from-uac-admin-rights for more information
By now, I would just prepend this oneliner into each batch-file needing elevation:
@pushd "%~dp0" & fltmc | find "." && (powershell start '"%~f0"' ' %*' -verb runas 2>nul && popd && exit /b)
Both the initial batch file and one-liner are from [Wayback/Archive] windows – How can I auto-elevate my batch file, so that it requests from UAC administrator rights if required? – Stack Overflow (thanks [Wayback/Archive] Ir Relevant, [Wayback/Archive] ceztko, [Wayback/Archive] Jamesfo, and [Wayback/Archive] PDixon724)
Note that the net file trick below should actually be repeated twice. This is explained in [Wayback/Archive] windows – Batch script: how to check for admin rights – Stack Overflow (thanks [Wayback/Archive] zumalifeguard), but wait: there is even a better solution!
The fltmc trick above works much better than the net file trick and is available from Windows XP and up, see [Wayback/Archive] windows – Batch script: how to check for admin rights – Stack Overflow (thanks [Wayback/Archive] npocmaka).
Oh: on systems where I have full installation control, I always install gsudo, see gsudo (sudo for windows).
–jeroen
Read the rest of this entry »
Posted in .NET, Batch-Files, CommandLine, Development, PowerShell, PowerShell, Scripting, Software Development | Leave a Comment »
Posted by jpluimers on 2025/08/12
Posted in .NET, Batch-Files, CommandLine, Development, Power User, PowerShell, PowerShell, Scripting, Software Development, Windows, Windows 10, Windows 11, Windows 8.1 | Leave a Comment »
Posted by jpluimers on 2025/08/06
Sometimes I need [Wayback/Archive] Redirect Checker | Check your Statuscode 301 vs 302 on the command-line, so cURL to the rescue: [Wayback/Archive] linux – Get final URL after curl is redirected – Stack Overflow. The relevant portions of answers and comments further below.
TL;DR:
Since I prefer verbose command-line arguments (you can find them at the [Wayback/Archive] curl – How To Use on-line man page) especially in scripts this HTTP GET request is what works with Twitter:
% curl --location --silent --output /dev/null --write-out "%{url_effective}\n" https://twitter.com/anyuser/status/20
https://x.com/anyuser/status/20
This failed (twitter dislikes HTTP HEAD requests):
% curl --head --location --silent --output /dev/null --write-out "%{url_effective}\n" https://twitter.com/anyuser/status/20
https://twitter.com/anyuser/status/20
Notes
Given so many of my scripts now run on zsh, I added the new-line because of command line – Why does a cURL request return a percent sign (%) with every request in ZSH? – Stack Overflow. You can strip that bit.
Note that these do not perform client side redirects, so they do not return the ultimate originating URL https://x.com/jack/status/20 (which was the first ever Tweet on what was back then called twttr) as Twitter on the client-side overwrites window.location.href with the final URL. Similar behaviour for getting the Twitter user handle of a Twitter user ID, more on Twitter tricks below.
Tweet by TweetID trick via [Wayback/Archive] Accessing a tweet using only its ID (and without the Twitter API) – Bram.us.
Further reading (thanks [Wayback/Archive] vise, [Wayback/Archive] Daniel Stenberg, [Wayback/Archive] Ivan, [Wayback/Archive] AndrewF, [Wayback/Archive] Roger Campanera, and [Wayback/Archive] Dave Baird):
Read the rest of this entry »
Posted in *nix, *nix-tools, bash, Batch-Files, Bookmarklet, Communications Development, Conference Topics, Conferences, CSS, cURL, Development, Event, HTTP, Internet protocol suite, JavaScript/ECMAScript, Power User, Scripting, SocialMedia, Software Development, TCP, Twitter, Web Browsers, Web Development | Tagged: 76 | Leave a Comment »
Posted by jpluimers on 2025/07/29
Posted in .NET, Batch-Files, CommandLine, Development, Power User, PowerShell, PowerShell, Scripting, Software Development, Windows, Windows 10, Windows 11 | Leave a Comment »
Posted by jpluimers on 2025/07/21
This started out ad a post to make things easier for my mentally brother, but then I figured it makes it so much easier for myself as well: getting rid of the evern returning Windows nag screens. Not just the ones after logon during initial Windows install that get back about every other Windows 20H update (thank god they stepped away from 19## version numbering that felt so, ehm, last millennium), but also the various “suggestions” in start menu, on the taskbar and elsewhere.
I understand that basically giving Windows 10 and 11 for free to many Windows 7/8 licensed machines or Windows-preinstalled machines induces Microsoft to see Windows as an advertising environment, but hey: many users can do without these distractions.
It is hard to solve, as even the underlying registry settings seem to be reset every once in a while, and solving it globally is not an option: the settings are a per-user one. Which means you need to run script early during every Windows logon to overwrite these settings.
Read the rest of this entry »
Posted in Batch-Files, CommandLine, Conference Topics, Conferences, Development, Event, Power User, PowerShell, PowerShell, Registry Files, Scripting, Software Development, Windows, Windows 10, Windows 11, Windows Development | Tagged: 48 | Leave a Comment »
Posted by jpluimers on 2025/05/29
Now that Python 2 has been dead for long enough (has it been unsupported for 5 years? yes it has: [Wayback/Archive] Status of Python Versions), it was finally time to change my alias for running a local web-server to serve files from a directory (:
So, from [Wayback/Archive] What is the Python 3 equivalent of “python -m SimpleHTTPServer” – Stack Overflow (thanks [Wayback/Archive] ryanbraganza, [Wayback/Archive] k.avinash and [Wayback/Archive] Petr Viktorin):
python -m http.server 8000, it will start the server on port 8000
Docs with the migration hints: [Wayback/Archive] 20.19. SimpleHTTPServer — Simple HTTP request handler — Python 2.7.18 documentation
Read the rest of this entry »
Posted in *nix, *nix-tools, bash, Batch-Files, Development, Power User, Python, Scripting, Software Development | Leave a Comment »
Posted by jpluimers on 2025/05/02
Quite a while ago, Chrome moved from a structure based on “Current Session“, “Current Tabs“, “Last Session” and “Last Tabs” into “Session_#################” and “Tabs_#################” stored in a “Sessions” folder (and similar migrations for other state and configuration files).
The numbers in the “Session_*” and “Tabs_*” files are time stamps of those sessions, for instance one needs to figure out what the “13310808970819630” in “Session_13310808970819630” and “Session_13310808970819630” means.
Lot’s of web-pages with tips and tricks around the old structures are still around, often surfacing high in Google Search results.
I was interested in a particular trick to export Google Chrome browsing history and had a hard time figuring out the easiest solution.
Read the rest of this entry »
Posted in Apple, Batch-Files, Chrome, Chrome, Database Development, Development, Google, JavaScript/ECMAScript, Mac OS X / OS X / MacOS, NirSoft, Polyglot, Power User, Scripting, SQLite, Web Browsers, Windows, Windows 10, Windows 11 | Tagged: define | Leave a Comment »
Posted by jpluimers on 2025/04/23
A while ago, I needed to investigate reboot events on some Windows 10 systems. I wanted to use the console instead of the eventvwr GUI Event Viewer.
There is a tool for that called wevtutil which – like eventvwr – uses XPath query parameters and produces XML output.
Postprocessing XML can be a thing, but since .NET has great XML support, you can use PowerShell for that (which for me often is way easier than going the XSLT route, for instance because Windows lacks built-in console XSLT tooling).
Based on the help and the below links, my query command then on these machines turned out to be this: Read the rest of this entry »
Posted in Batch-Files, CommandLine, Development, PowerShell, PowerShell, Scripting, Software Development, XML, XML/XSD, XPath, XSLT | Leave a Comment »
Posted by jpluimers on 2025/01/08
Directly after a new Windows installation, I want to have my cloned git repository of batch files in the PATH persistently so that it gets searched after rebooting or opening a new console window.
At that moment, there is not much of a 1024 PATH character limitation, but be aware about that limit if you try this yourself.
This is my add-current-directory-to-path-at-end.persistent-and-limit-to-1024-characters.bat:
:: https://serverfault.com/questions/664180/can-i-permanently-add-to-path-in-windows-using-batch
:: https://superuser.com/questions/812754/how-to-recover-from-path-being-truncated-to-1024-characters-by-setx
:: global environment
setx PATH "%PATH%;%CD%"
:: local process
:: https://superuser.com/questions/975605/add-current-directory-to-path
set PATH=%PATH%;%CD%
I execute it from within the cloned git directory.
Oh: you need to double-quote the SETX parameters, otherwise you get an error message: “ERROR: Invalid syntax. Default option is not allowed more than '2' time(s).“.
More links than the above ones from the batch file, especially on the 1024 character limitation:
Read the rest of this entry »
Posted in Batch-Files, Development, Power User, Scripting, Software Development, Windows | Leave a Comment »