Just like in selling houses the three most important things are location, location, location, it seems that in answering questions, the three most important things are motivation, motivation and motivation...apparently. Here's my solution, it works like a charm. Feel free to comment, everything is subject to improvement.. <3 <3 <3
taskkill /im TOTALCMD64.EXE
IF %USERDOMAIN% == GwenKillerby goto Win10
echo win8
powershell -Command "(Get-Content f:\totalcmd852\wincmd.ini) | ForEach-Object { $_ -replace 'D\:\\', 'QzQ' } | Set-Content f:\totalcmd852\wincmd.ini"
powershell -Command "(Get-Content f:\totalcmd852\wincmd.ini) | ForEach-Object { $_ -replace 'C\:\\', 'D:\' } | Set-Content f:\totalcmd852\wincmd.ini"
powershell -Command "(Get-Content f:\totalcmd852\wincmd.ini) | ForEach-Object { $_ -replace 'QzQ', 'C:\' } | Set-Content f:\totalcmd852\wincmd.ini"
powershell -Command "(Get-Content f:\totalcmd852\wincmd.ini) | ForEach-Object { $_ -replace '\\', '\' } | Set-Content f:\totalcmd852\wincmd.ini"
goto ProgStart
:Win10
echo win10
powershell -Command "(Get-Content f:\totalcmd852\wincmd.ini) | ForEach-Object { $_ -replace 'C\:\\', 'QzQ' } | Set-Content f:\totalcmd852\wincmd.ini"
powershell -Command "(Get-Content f:\totalcmd852\wincmd.ini) | ForEach-Object { $_ -replace 'D\:\\', 'C:\' } | Set-Content f:\totalcmd852\wincmd.ini"
powershell -Command "(Get-Content f:\totalcmd852\wincmd.ini) | ForEach-Object { $_ -replace 'QzQ', 'D:\' } | Set-Content f:\totalcmd852\wincmd.ini"
powershell -Command "(Get-Content f:\totalcmd852\wincmd.ini) | ForEach-Object { $_ -replace '\\', '\' } | Set-Content f:\totalcmd852\wincmd.ini"
:ProgStart
f:\totalcmd852\TOTALCMD64.EXE
(BTW: if anyone can tell me why in 'C\:\\', 'D:\' 'C' needs two slashes while for 'D' one is enough, I'd be so happy.)
First, I tried to make it conditional upon Windows version via a tmpfile which is a more elegant and robust manner.
rem VER > tmpFile
rem set /p myvar= < tmpFile
rem del tmpFile
But I couldn't get it to work, so I used UserWhatever. Also, the output of VER in both Win10 and 8 are virtually identical: Microsoft Windows [6.xxx] versus Microsoft Windows [10.xxx], which means working with those creepy tokens, brrrr!
I'm open to any solution which has less lines or is less complex than. Or, you know, a full PS script/batfile ... ;) ;) ;)