I want to store this command in a variable called code1
dir /a:d /b
so the output would be: Folder1 Folder2 Folder3 etc... Any ideas how to do it? I've checked other questions and when it just sais echo is off.
I want to store this command in a variable called code1
dir /a:d /b
so the output would be: Folder1 Folder2 Folder3 etc... Any ideas how to do it? I've checked other questions and when it just sais echo is off.
Simply store the command in the variable like you say. To execute, simply expand the value:
@echo off
setlocal
:: Define a simple "macro"
set "code1=dir /a:d /b"
:: Execute the "macro"
%code1%