China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-05 17:57
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Question: how to use variables as command parameters View 727 Replies 2
Original Poster Posted 2007-09-02 19:31 ·  中国 上海 松江区 电信
新手上路
Credits 15
Posts 4
Joined 2007-08-31 10:15
18-year member
UID 96244
Gender Male
From 江西
Status Offline
I have a program on hand right now that I need to run with parameters, but I want to make the parameter (or part of the parameter) be read from a variable.. I don't know how to do that.. what format should be used..

For example copy variable\filename variable
That is to say, I want to use a variable as the parameter after the command.. or as part of the parameter...
Floor 2 Posted 2007-09-02 19:45 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
In BAT you can use variables assigned with the SET statement
Floor 3 Posted 2007-09-02 20:25 ·  中国 浙江 杭州 电信
高级用户
★★
Credits 537
Posts 219
Joined 2007-08-04 09:43
19-year member
UID 94620
Gender Male
From 杭州--半山
Status Offline
for /f %%a in ('dir d:\*.exe /s /b /a-d') do copy %%a foldername\%%a
Forum Jump: