• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2138
  • Last Modified:

Equivalent command to Unix export paramfile=`cat /dir/dir/dir/paramlist.txt`

I am trying to replicate the following Unix command set to MS-DOS  is there an equivalent in MS-DOS

export paramfile=`cat /dir/dir/dir/paramlist.txt`
..../dsjob -run $paramfile PROJECTNAME JOBNAME

MS-DOS that I have tried is

set paramfile='type c:\parameters.txt'
C:\...\dsjob.exe  -run %paramfile% ...

  • 2
  • 2
1 Solution
Lee W, MVPTechnology and Business Process AdvisorCommented:
Translate the unix into englilsh (what you want to do) and we'll see if we can help.  Otherwise, you may be waiting for someone who knows both well.
That is a pretty good direct translation ... but DOS doesn't quite work that way.  What is the format of the parameters.txt file?  Is it one line per parameter like:
or does it have the declare syntax like:
declare -x FILENAME="TEST.TXT"
or is it something else?  If it is one line per parameter without declare, AND it is running under a command prompt under Windows NT/2000/XP/2003, you can try something like this in a batch file:

for /f "delims=" %%a in (c:\parameters.txt) do set %%a
C:\...\dsjob.exe -run PROJECTNAME JOBNAME

Do you know if the "DOS" version of this program takes the parameters from the environment?  The "for" line should load all the values into the current environment if they are in the right format, so I wouldn't think there would be a need to pass them in the .exe file if it does read them from the environment.

If they are in the "declare" format, then maybe try stripping each line down to just "variable=value" syntax and try it.
Hi GuruGary,

Actually, if they are in the "declare -x" format, then you could still use your FOR /F idea. You'd just have to modify it a bit:

FOR /F "TOKENS=2*" %%F IN (parameters.txt) DO (SET %%G)

This will use space as the delimeter to skip "declare", place "-x" into %%F which we then ignore. Then the rest of the line goes into %%G to include spaces if needed.

Hi Sirbounty,

Long time, no see. My fault entirely.

I just suggested a minor modification to GuruGary's idea. All points should be awarded to him.

Well thanks, pb!  No objections to that from me.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now