I'm trying to create a .BAT file where it will create App Links and Web Links using MkLink but I can't seem to get it running.
@echo off
SET LINK_APPROOT=C:\Users\Intern\Desktop\debugprojects\GeneratedAppServer
SET LINK_WEBROOT=C:\Users\Intern\Desktop\debugprojects\GeneratedWebServer
SET TARGET_ROOT=C:\inetpub\wwwroot
SET WWWROOT_DIR=C:\inetpub\wwwroot
SET CURRENT_DIR=%~dp0
REM Creating App links
mklink /j %LINK_APPROOT%\GeneratedAppServer\commandline %TARGET_ROOT%\App\App_Code\commandline
mklink /j %LINK_APPROOT%\GeneratedAppServer\dbaccess %TARGET_ROOT%\App\App_Code\dbaccess
mklink /j %LINK_APPROOT%\GeneratedAppServer\entitydef %TARGET_ROOT%\App\App_Code\entitydef
mklink /j %LINK_APPROOT%\GeneratedAppServer\hub %TARGET_ROOT%\App\App_Code\hub
mklink /j %LINK_APPROOT%\GeneratedAppServer\lib %TARGET_ROOT%\App\App_Code\lib
mklink /j %LINK_APPROOT%\GeneratedAppServer\service %TARGET_ROOT%\App\App_Code\service
REM Creating Web links
mklink /j %LINK_WEBROOT%\GeneratedWebServer\entitydef %TARGET_ROOT%\Web\App_Code\entitydef
mklink /j %LINK_WEBROOT%\GeneratedWebServer\hub %TARGET_ROOT%\Web\App_Code\hub
mklink /j %LINK_WEBROOT%\GeneratedWebServer\lib %TARGET_ROOT%\Web\App_Code\lib
mklink /j %LINK_WEBROOT%\GeneratedWebServer\View_Code %TARGET_ROOT%\Web\App_Code\View_Code
mklink /j %LINK_WEBROOT%\GeneratedWebServer\web\App_Pages %TARGET_ROOT%\Web\App_Pages
mklink /j %LINK_WEBROOT%\GeneratedWebServer\web\Images %TARGET_ROOT%\Web\Images
mklink /j %LINK_WEBROOT%\GeneratedWebServer\web\Scripts %TARGET_ROOT%\Web\Scripts
mklink /j %LINK_WEBROOT%\GeneratedWebServer\web\WS %TARGET_ROOT%\Web\WS
pause
What should I change, or am I missing? I am new to create .bat file and using mklink.
Read
mklink
description ormklink /?
:Both errors are related to the
Link
part of commands, see next example:Use
echo ON
to see exactly what happens.BTW, the
%~dp0
and%CD%
directories could differ:%~dp0
= folder where a script resides%CD%
= current directory