@echo off
set "yourDir=C:\Users\asus\Desktop"
echo:List only files:
for %%a in ("%yourDir%\*") do echo %%~fa
echo:List only directories:
for /d %%a in ("%yourDir%\*") do echo %%~fa
echo:List directories and files in one command:
for /f "usebackq tokens=*" %%a in (`dir /b "%yourDir%\*"`) do echo %yourDir%\%%~a
pause
i have a cmd
script and i want to include and run it in a c
script
and if possible modify it (the cmd
script contains variables ).
do you have a solution ?
UPDATE
You can create a script file on-the-fly in the C program that you will call it from. Note you must handle the characters
"
and\
and%
specially when part of a string literal, by using\"
and\\
and%%
respectively.Script file generated: