Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Execute the command-line code
#1
Hi,

The code below works fine in QM, How to run in LA

Macro Macro24
 
Code:
Copy      Help
_s=
;@echo off
;set name=hello 你好
;for /l %%i in (0,1,5) do (
;;;;;echo %name%
;)

__TempFile f.Init(".bat" "" "" _s)
RunConsole2(f _s "" 0x800)
mes _s


Run failed:
 
Code:
Copy      Help
var commands = """
@echo off
set name=hello 你好
for /l %%i in (0,1,5) do (
    echo %name%
)
"""
;
commands = commands.Replace("\r\n", " && ");
run.console("cmd.exe", $@"/u /c ""{commands}""", encoding: Encoding.Unicode);


Run failed:
Code:
Copy      Help
var commands = """
@echo off
set name=hello 你好
for /l %%i in (0,1,5) do (
    echo %name%
)
"""
;
string file1 = folders.ThisAppTemp + "bat.bat";
filesystem.saveText(file1, commands, encoding: Encoding.Default);
run.console("cmd.exe", $"{file1}", encoding: Encoding.Default);
#2
The last line in the last code.

Code:
Copy      Help
run.console(file1, encoding: Encoding.Default);
#3
thanks , worked well


Forum Jump:


Users browsing this thread: 1 Guest(s)