Multi Commander Support Forum

Multi Commander => Script => Topic started by: log on October 09, 2021, 02:23:36

Title: run cmd command in script
Post by: log on October 09, 2021, 02:23:36
hi,
please, i will run this command in the script of multicommander:
mklink /D "D:\Cloud\Folder" "C:\Labo\MyFolder\"
it run correctly in cmd;
but i will run in in script.
thank you.
Title: Re: run cmd command in script
Post by: mlabrkic on February 20, 2022, 19:53:43
I'm sorry,

I deleted the web links...
maybe I'll write something later.
Title: Re: run cmd command in script
Post by: AlanJB on February 21, 2022, 00:41:49
Please don't post links to remotely hosted scripts - many of us will NOT follow unknown links.

Instead, post your scripts here in code blocks.

Thanks
Title: Re: run cmd command in script
Post by: mlabrkic on March 01, 2022, 15:10:51
Hi,
/Windows has two command-line shells: the Command shell and PowerShell./

Windows Command shell:
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/windows-commands

An A-Z Index of Windows CMD commands:
https://ss64.com/nt/

MKLINK:
https://ss64.com/nt/mklink.html

MKLINK [[/D] | [/H] | [/J]] LinkName Target
/D     Create a Directory symbolic link. (default is file)
By default, only Administrators can create symbolic links.

Code: [Select]
// ------------------------------------------------------------
// http://forum.multicommander.com/forum/index.php/topic,1345.msg4769.html#msg4769

// To create Symlinks you must be admin.
// You can add "ASADMIN" and you will get a UAC dialog, or you can start MC as admin.

// LNKTYPE 3 = Symlink
// MC.Utils.CreateLink ASADMIN LNKTYPE=3 LNKSRC="<new source folder>" LNKTRG="<existing target folder>"

// <new source folder>  Must not exists.
// <existing target folder>  It exists.

// UAC dialog is shown and MCAdmin (Admin helper Process) is starts
// SymLink folder is created and points to existing target folder

// ------------------------------------------------------------
// http://multicommander.com/docs/customcommands_list#mc.utils.createlink
// MC.Utils.CreateLink
// LNKTYPE 1 = Hardlink, 2 = Junction, 3 = Symlink, 4 = Shortcut

// Windows CMD command:
// MKLINK [[/D] LinkName Target
//    /D     Create a Directory symbolic link. (default is file)

// We're trying this:
// mklink /D "D:\Cloud\Folder" "C:\Labo\MyFolder\"

// ------------------------------------------------------------

@var $source_folder = "D:\\Cloud\\Folder\\";

// @var $env = TranslateEnvString("%USERPROFILE%");
// @var $target_folder = $env ^ "Documents\\MyFolder\\";
@var $target_folder = "C:\\Labo\\MyFolder\\";

// LNKTYPE 3 = Symlink
MC.Utils.CreateLink ASADMIN LNKTYPE=3 LNKSRC={$source_folder} LNKTRG={$target_folder}