Jump to content

Passing variable to script from file using DOS


Recommended Posts

I've got a vbs script which reads argument and takes it as a variable i.e.

myscript.vbs /var:1

my script reads this as

StrMyvar = Wscript.Arguments.Named("var")

Is there any way of passing value to var from file in Linux it would look like this

myscript /var:`cat /path/to/file` what is the equivalent of this in DOS?

Link to comment
Share on other sites


To prevent non-functional or completely incorrect attempts at helping you with this problem, could you please try to explain a little better what it is you are trying to do and achieve.

Link to comment
Share on other sites

Hi, thanks for response.

Let's say I've got a file called myfile with 1 line written in it:

c:\windows

Is there any way of calling dos cd comman and pass that line from the file so result would be

cd c:\windows

?

Thanks for your help

Link to comment
Share on other sites

Hi, thanks for response.

Let's say I've got a file called myfile with 1 line written in it:

c:\windows

Is there any way of calling dos cd comman and pass that line from the file so result would be

cd c:\windows

?

Thanks for your help

For /F %%A in (myfile.txt) DO cd %%A

:unsure:

Though it would be easier to write the whole line:

cd c:\windows

to a file, give it the .bat or .cmd extension and START it.

jaclaz

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...