- 2,486
- 839
- NAS
- Synology, TrueNAS
- Operating system
- Linux
- Windows
when you are still having trouble setting up your Win OS based PC and can't map or resolve your NAS via NASNAME and you want to use NASNAME in the mapping only, here is a small script for your quick action:
you need just edit this script in last line and replace part "NAS.IP.ADDRESS NASNAME" like this: 192.168.100.10 MYNAS
then save the script to somewhere e.g. C:\script.bat
and RUN it as ADMINISTRATOR
restart your computer and enjoy!
Bash:
@echo off
SET NEWLINE=^& echo.
FIND /C /I "servername" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO %NEWLINE%^NAS.IP.ADDRESS NASNAME>>%WINDIR%\System32\drivers\etc\hosts
you need just edit this script in last line and replace part "NAS.IP.ADDRESS NASNAME" like this: 192.168.100.10 MYNAS
then save the script to somewhere e.g. C:\script.bat
and RUN it as ADMINISTRATOR
restart your computer and enjoy!