Question

I'm learning Vagrant and Virtualbox, Now to add a line to my hosts file in a (windows)

echo "test" >> c:/windows/system32/drivers/etc/hosts

But i'm wondering if i can make a Shortcut to c:/windows/system32/drivers/etc/hosts that i can use in any shell from everywhere.

No correct solution

OTHER TIPS

You might create an environment variable:

[System.Environment]::SetEnvironmentVariable('Youralias','c:/windows/system32/drivers/etc/hosts','Machine)

and then access it using

$env:YourAlias

from PowerShell... If you want to access it from CMD

%Youralias%

should work.

Easier solution using a .bash_profile file

In your home folder (windows) you can make a .bash_profile file and specify aliases. Go to your home folder

cd ~

make a .bash_profile file and open it in vim or any other editor

touch .bash_profile && vim .bash_profile

add a new alias by adding the following line

alias testfolder="cd /c/testfolder"

save and close your editor.

Explanation someone?

For some reason it only works after i run the following command

source .bash_profile
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top