Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
- Start-Process PowerShell -Verb RunAs "-NoProfile -ExecutionPolicy Bypass -Command `"cd '$pwd'; & '$PSCommandPath';`"";
- exit;
- }
- function Test-ReparsePoint([string]$path) {
- $file = Get-Item $path -Force -ea SilentlyContinue
- return [bool]($file.Attributes -band [IO.FileAttributes]::ReparsePoint)
- }
- if(Test-Path "A:\"){
- Write-Host "Ramdisk already mounted"
- } else {
- Write-Host "Ramdisk missing, creating now"
- cmd.exe /c "`"C:\Program Files\SoftPerfect RAM Disk\ramdiskws.exe`" /add:`"letter=A,fs=NTFS,size=1500M,type=boot,mount=yes`""
- }
- $source="C:\Program Files (x86)\Atmel\studio\7.0"
- $dest="A:\Atmel"
- if((Test-ReparsePoint("$source")) -AND (Test-Path "$source\toolchain")){
- Write-Host "Already manipulated atmel studio"
- } else {
- if(Test-Path "C:\Program Files (x86)\Atmel\studio\7.0_old"){
- Write-Host "Restoring old Atmel Studio"
- del -force "$source"
- cmd.exe /c "rename `"C:\Program Files (x86)\Atmel\studio\7.0_old`" `"7.0`""
- }
- Write-Host "copy now"
- $what = @("/MIR")
- #couldnt get options to work :(
- #$options = @("/XD:\toolchain\arm","/XD:\toolchain\avr32","/XD:\packs\atmel`"")
- $options = @("/NFL","/NDL")
- $cmdArgs = @("$source","$dest",$what,$options)
- robocopy @cmdArgs /XD $source\toolchain\arm /XD $source\toolchain\avr32 /XD $source\packs\atmel
- #copy missing pack
- $cmdArgs = @("$source\packs\atmel\ATmega_DFP","$dest\packs\atmel\ATmega_DFP",$what,$options)
- robocopy @cmdArgs
- Write-Host "creating symlinks"
- cmd.exe /c "rename `"$source`" `"7.0_old "
- cmd.exe /c "mklink /J `"$source`" `"$dest`""
- }
- $source="C:\Program Files (x86)\ATMega Remote"
- $dest="A:\ATMega Remote"
- if((Test-ReparsePoint("$source")) -AND (Test-Path "$source\ATMega Remote.exe")){
- Write-Host "Already manipulated ATMR"
- } else {
- if(Test-Path "C:\Program Files (x86)\ATMega Remote_old"){
- Write-Host "Restoring old ATMR"
- del -force "$source"
- cmd.exe /c "rename `"C:\Program Files (x86)\ATMega Remote_old`" `"ATMega Remote`" "
- }
- Write-Host "copy now"
- $what = @("/MIR")
- $options = @("/NFL","/NDL")
- $cmdArgs = @("$source","$dest",$what,$options)
- robocopy @cmdArgs
- Write-Host "creating symlinks"
- cmd.exe /c "rename `"$source`" `"ATMega Remote_old "
- cmd.exe /c "mklink /J `"$source`" `"$dest`""
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement