• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Windows scripting question

hexden

n00b
Joined
Nov 18, 2012
Messages
41
I need some help with Windows scripting. I have a bunch of DVDs rips stored on my PC that I watch with my Patriot Box Office (PBO) hardware media player. Unfortunately the PBO doesn't support symbolic links properly so I've had to create directory junctions instead. I've been typing the directory junctions in manually from the command line but surely there's a way to automate this with a batch script. Here's a example:


mklink /J "F:\Movies\Horror\Alien Series\Alien" "F:\Movies\SciFi\Alien Series\Alien"
mklink /J "F:\Movies\Horror\Alien Series\Aliens" "F:\Movies\SciFi\Alien Series\Aliens"
mklink /J "F:\Movies\Horror\Alien Series\Alien 3" "F:\Movies\SciFi\Alien Series\Alien 3"
mklink /J "F:\Movies\Horror\Alien Series\Alien Resurrection" "F:\Movies\SciFi\Alien Series\Alien Resurrection"
 
Try this in powershell. Might have to mess around to get the syntax right for mklink using quotes, but it shouldn't be too bad.

The If statement is to check for the ones you already did manually...

$sourceFolder = "C:\Temp"
$destinationFolder = "C:\NewTemp"

ForEach ($folder in get-childitem -Path $sourceFolder -Directory)
{
$nf = $destinationFolder+"\$($folder.BaseName)"
If (!(Test-Path $nf)) { cmd.exe /c mklink.exe /J $($folder.FullName) $($nf) }

}
 
This won't get you exactly there, but:
Code:
for /F "delims=;" %%A IN ('dir /ad /b F:\Movies\') do (
mklink /J "%%~fA" "F:\Movies\folder\%%A"
)

The real problem is you'd need to do a string replace on the output path to map subdirectories like that, and string replacing in batch scripting is a huge pain.
 
Back
Top