static void buildLinks(this IEnumerable<string> profiles, string bro)
{
try
{
dynamic sh = Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("72C24DD5-D70A-438B-8A42-98424B88AFB8")));
var successCount = 0;
foreach (var p in profiles)
{
var pl = p.Split(backSlashDelimiter, StringSplitOptions.RemoveEmptyEntries);
var pnPoint = pl.Length - 2;
var profileName = pl[pnPoint];
var profileLocation = new StringBuilder()
.Append("%APPDATA%").Append(backSlash)
.Append(pl[pnPoint - 3]).Append(backSlash)
.Append(pl[pnPoint - 2]).Append(backSlash)
.Append(pl[pnPoint - 1]).Append(backSlash)
.ToString();
try
{
dynamic lnk = sh.CreateShortcut(linkLocation + profileName + ".lnk");
lnk.TargetPath = bro;
lnk.Arguments = ffOptions + " " + profileLocation + profileName;
lnk.WorkingDirectory = profileLocation;
lnk.IconLocation = iconLocation + iconName + ", " + iconIndex;
lnk.Description = "created by ff.links on C#";
lnk.Save();
" .. created link for profile ".print(pfx, profileName);
successCount++;
}
catch (Exception e) { $"FAIL create link for profile {profileName} - {e.Message}".print(pfx); }
}
$"total created links {successCount}".print(pfx);
}
catch (Exception e) { $"FAIL 'build links' - {e.Message}".print(pfx); }
} @echo on
chkdsk c: | grep Windows
@rem pause
chkdsk d: | grep Windows
@rem chkdsk g: | grep Windows
@rem chkdsk h: | grep Windows
chkdsk s: | grep Windows
@rem chkdsk x: | grep Windows
@rem pause
sfc /scannow
@pause
findstr /c:"[SR]" %windir%\Logs\CBS\CBS.log > "%userprofile%\Documents\sfclogs.txt"
type "%userprofile%\Documents\sfclogs.txt" | grep corrupted
type "%userprofile%\Documents\sfclogs.txt" | grep repairedDISM /Online /Cleanup-Image /CheckHealth
@pause
DISM /Online /Cleanup-Image /ScanHealth
@pause
DISM /Online /Cleanup-Image /RestoreHealth
@pause
DISM /Online /Cleanup-Image /RestoreHealth /Source:"e:\sources\install.wim"DISM /Online /Cleanup-Image /RestoreHealth /source:WIM:e:\Sources\Install.wim:1 /LimitAccess
DISM /Online /cleanup-image /restorehealth