p123654987
Casual
- Jul 17, 2024
- 0
- 35
You could pretty easily throw together a powershell script using ChatGPT or something to randomly pick files that you've downloaded. I've done something similar to open videos/pictures at random for a roulette style goon sesh and it works pretty well. Can't say for online though.Does anyone know if there is a site that when clicking a link, an random joi/cei video starts playing without you knowing which one, kind of like a roulette.
I don't think this is against the rules, but here's the code. Keep in mind this excludes a directory called "S" where I keep music, so just don't have a folder called that I guess, or use ChatGPT or your brain to modify it lol.
Code:
param()
$ErrorActionPreference = 'SilentlyContinue'
# Lock execution to folder where .exe/.ps1 resides
$scriptPath = Split-Path -Path ([System.Diagnostics.Process]::GetCurrentProcess().MainModule.FileName)
Set-Location -Path $scriptPath
# Get only subfolders (excluding root and any named 'S')
$folders = @()
$childFolders = Get-ChildItem -Recurse -Directory | Where-Object { $_.Name -ne 'S' -and $_.FullName -notmatch '\\S(\\|$)' }
foreach ($folder in $childFolders) {
$files = Get-ChildItem -Path $folder.FullName -File | Where-Object { $_.Length -gt 0 }
if ($files.Count -gt 0) {
$folders += $folder
}
}
if ($folders.Count -eq 0) { exit }
# Pick random subfolder, then random file within it
$randomFolder = $folders | Get-Random
$files = Get-ChildItem -Path $randomFolder.FullName -File | Where-Object { $_.Length -gt 0 }
if ($files.Count -eq 0) { exit }
$randomFile = $files | Get-Random
# Open the file silently
Invoke-Item -LiteralPath $randomFile.FullName
Throw that in a file called "Code.ps1" and run that bitch and it'll grab a file within any subfolder in its directory (Except folders called "S") at random.
Code probably sucks but I'm not a programmer and I hella didn't write it so critique and modify as necessary.
Also sorry if the formatting sucks, I don't post much.
Edit to add: I'm dumb and forgot I recompiled it to be an .exe file because Windows won't let you natively doubleclick a .ps1 file. I used this tool I found on github. https://github.com/MScholtes/PS2EXE
In general it's not great security practice to be able to run .ps1 scripts by double clicking but if you wrote the code (or know what it is) then fuck it
Last edited:

