Avatar of PDSWSS
PDSWSS

asked on 

Can I use computer name.domain instead of the IP address in the path in a cmd file?

I have set up a cmd file (attached) that backs up a folder from a local server to a remote server.

I will soon need to change the remote backup location.  The computer at the new location is set up with a dynamic IP and a fixed computer.domain name.   Will the code work if the IP address is replaced with the computer.domain name?


@echo off

:: variables
set drive=\\132.99.188.345\Shared$\Backups\TEST
set folder=Test_%date:~10,4%_%date:~4,2%_%date:~7,2%
set backupcmd=xcopy/s/c/d/e/h/i/r/y

md "%drive%\%folder%"

@echo %backupcmd% "C:\shared$\Test1" "%drive%\%folder%"
%backupcmd% "C:\shared$\Test1" "%drive%\%folder%"

echo Backup Complete!
@pause

Open in new window

Microsoft DOSStorage SoftwareWindows Server 2008

Avatar of undefined
Last Comment
PDSWSS

8/22/2022 - Mon