Skip to main content
Inspiring
June 14, 2022
Answered

Extendscript after effects how do i run this cmd command from my script simple one line command

  • June 14, 2022
  • 2 replies
  • 1148 views

if i run this command on windows cmd

type "%localappdata%\temp\ClipBoard.txt" | clip

it copies all content of that txt to the clipboard excellent.

now, do I execute this command in extend-script without getting any script error popups or admins rights popups?

 

CopyClipboardd.onClick = function(){ 
var cmd, isWindows;
path = Folder.temp.fsName + "/ClipBoard.bat"
cmd = 'cmd.exe /c cmd.exe /c "echo type "%localappdata%\temp\ClipBoard.txt" | clip"';
system.callSystem(cmd);
}

 this is what I have cmd pops up but the code is not executing well I guess. kindly assist me asap anybody, please.

This topic has been closed for replies.
Correct answer Arnaldo242456048gki

Sorted fixed it only 1 \ made a difference

 

    CopyClipboardd.onClick = function(){ 
        
        //type "%localappdata%\temp\ClipBoard.txt" | clip
var cmd, isWindows;
var path;

copyTextToClipboard2(tbProp.text)
cmd = 'cmd.exe /c cmd.exe /c \" type "%localappdata%\\temp\\ClipBoard.txt" | clip"';
system.callSystem(cmd);

}

 

2 replies

Mylenium
Legend
June 14, 2022

The Windows command prompt/ scripting host itself runs with escalated permissions. In order to bypass any security warnings or dialogs you may need to mess with your group policies, create a special registry key or change the user level in your batch file and then invoke cmd. Nothing to do with AE, just how Windows works.

 

Mylenium

Arnaldo242456048gkiAuthorCorrect answer
Inspiring
June 14, 2022

Sorted fixed it only 1 \ made a difference

 

    CopyClipboardd.onClick = function(){ 
        
        //type "%localappdata%\temp\ClipBoard.txt" | clip
var cmd, isWindows;
var path;

copyTextToClipboard2(tbProp.text)
cmd = 'cmd.exe /c cmd.exe /c \" type "%localappdata%\\temp\\ClipBoard.txt" | clip"';
system.callSystem(cmd);

}

 

Inspiring
June 14, 2022

cmd = 'cmd.exe /c cmd.exe /c "echo type "%localappdata%\\temp\\ClipBoard.txt" | clip"';
system.callSystem(cmd);

 

not working