Author Topic: run cmd command in script  (Read 7328 times)

log

  • Newbie
  • *
  • Posts: 1
    • View Profile
run cmd command in script
« 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.

mlabrkic

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: run cmd command in script
« Reply #1 on: February 20, 2022, 19:53:43 »
I'm sorry,

I deleted the web links...
maybe I'll write something later.
« Last Edit: February 22, 2022, 15:56:59 by mlabrkic »

AlanJB

  • VIP Member
  • *****
  • Posts: 432
  • VERY old Programmer
    • View Profile
Re: run cmd command in script
« Reply #2 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

mlabrkic

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: run cmd command in script
« Reply #3 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}

« Last Edit: March 01, 2022, 15:36:24 by mlabrkic »