๐ฎ๐ Dotfiles and configs for different things Windows. ๐ข๐ ๏ธ
Note: Set-Dotfiles script requires to be run as admin
Open terminal as admin and first run this ๐ฝ command to be temporarily bypassed ExecutionPolicy
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
If that is not a concerns run bellow command, it will require that all scripts and configuration files downloaded from the Internet be signed by a trusted publisher.
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
Use the command bellow to ๐ quickly setup ๐ต dotfiles:
Invoke-Expression (Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/RustyTake-Off/win-dotfiles/main/.config/scripts/Set-Dotfiles.ps1' -UseBasicParsing).Content | Invoke-Expression
Invoking โ๏ธ this script will:
- Create
pr
andwk
folders in user directory - Clone this repository and save it in the user directory (if the repo is present it will be updated)
- Create
SymbolicLinks
for:- PowerShell profiles
- PowerShell scripts
- Winget config
- WSL config
- Copy Windows Terminal config (for some reason using
SymbolicLinks
breaks Windows Terminal updates)
For more โ hands on approach here are the ๐พ steps to set it up.
Clone repo in ๐ป bare
mode into .dotfiles
directory.
git clone --bare 'https://github.com/RustyTake-Off/win-dotfiles.git' "$env:USERPROFILE\.dotfiles"
Checkout repo into ๐ home directory.
git --git-dir="$env:USERPROFILE\.dotfiles" --work-tree=$env:USERPROFILE checkout
Set git to not show untracked files.
git --git-dir="$env:USERPROFILE\.dotfiles" --work-tree=$env:USERPROFILE config status.showUntrackedFiles no
Lastly run this script.
pwsh "$env:USERPROFILE\.config\scripts\Set-Dotfiles.ps1"
Everything should be in place ๐
Updating ๐ต dotfiles is done by using a dot function
which is already in the ๐ฐ PowerShell profile. Normally it would be an alias but for some reason the Set-Alias
with this command doesn't work so it's easier to put it into a function
.
function dot {
git --git-dir="$env:USERPROFILE\.dotfiles" --work-tree=$env:USERPROFILE $Args
}
To update dotfiles run:
dot pull
Another way is to use the Set-Dotfiles
script in admin terminal. In ๐ฐ PowerShell profile there is an admin function
which auto opens admin terminal and runs passed command there.
function admin {
if (-not $Args) {
Start-Process wt -Verb RunAs -ArgumentList "pwsh -NoExit -ExecutionPolicy Bypass -Command `
cd $(Get-Location)"
} else {
Start-Process wt -Verb RunAs -ArgumentList "pwsh -NoExit -ExecutionPolicy Bypass -Command `
cd $(Get-Location) `
$Args"
}
}
To use it, run this command:
admin Set-Dotfiles.ps1
Note: Use-WinUp script also needs to be run as admin.
You might want to not change the Execution Policy
permanently ๐ง so to change it only for the current process run the bellow command and then use the script.
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
If that is not a concerns run bellow command, it will require that all scripts and configuration files downloaded from the Internet be signed by a trusted publisher.
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
Since it is a setup script you won't โ have git
installed so to download this script run the bellow ๐ command which will get the script and save it on the desktop.
Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/RustyTake-Off/win-dotfiles/main/.config/scripts/Use-WinUp.ps1' -UseBasicParsing -OutFile "$env:USERPROFILE\Desktop\Use-WinUp.ps1"
Then go to where it is saved and use the script.
Set-Location -Path "$env:USERPROFILE\Desktop"