Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shell shortcuts to folders in Windows

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.

like image 262
Miguel Stevens Avatar asked Dec 02 '25 07:12

Miguel Stevens


1 Answers

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.

like image 148
Adil Hindistan Avatar answered Dec 03 '25 22:12

Adil Hindistan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!