?
Solved

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

Posted on 2006-06-14
7
Medium Priority
?
2,098 Views
Last Modified: 2012-05-05
I am trying to replicate the following Unix command set to MS-DOS  is there an equivalent in MS-DOS

Unix
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% ...

0
Comment
Question by:reccles
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
7 Comments
 
LVL 96

Expert Comment

by:Lee W, MVP
ID: 16907192
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.
0
 
LVL 10

Accepted Solution

by:
GuruGary earned 500 total points
ID: 16907792
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:
FILENAME=TEST.TXT
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.
0
 
LVL 10

Expert Comment

by:pbarrette
ID: 16956436
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.

pb
0
 
LVL 10

Expert Comment

by:pbarrette
ID: 17198042
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.

pb
0
 
LVL 10

Expert Comment

by:GuruGary
ID: 17198206
Well thanks, pb!  No objections to that from me.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month8 days, 2 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question