Link to home
Start Free TrialLog in
Avatar of earngreen
earngreenFlag for United States of America

asked on

parameter as a Filename

I am trying to pass a paramater as a file name something to the effect of

Set name = %1
echo 2> C:\ %name%_Finished.txt

The expected resukts should be
Bill_Finished.txt

Does anyone know how I would go about acomplishing?
Avatar of Shift-3
Shift-3
Flag of United States of America image

Just remove the extra spaces and the 2 from the second line (2> is used to redirect errors to a file rather than standard output).  Change echo to echo. to echo a single blank line.  It's also usually a good idea to enclose the file path in quotes in case it contains a space.




Set name=%1
echo. > "C:\%name%_Finished.txt"

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Shift-3
Shift-3
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial