wally Posted January 8, 2009 Posted January 8, 2009 I've got a vbs script which reads argument and takes it as a variable i.e.myscript.vbs /var:1my script reads this asStrMyvar = Wscript.Arguments.Named("var")Is there any way of passing value to var from file in Linux it would look like thismyscript /var:`cat /path/to/file` what is the equivalent of this in DOS?
Yzöwl Posted January 8, 2009 Posted January 8, 2009 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.
wally Posted January 15, 2009 Author Posted January 15, 2009 Hi, thanks for response.Let's say I've got a file called myfile with 1 line written in it:c:\windowsIs there any way of calling dos cd comman and pass that line from the file so result would becd c:\windows?Thanks for your help
jaclaz Posted January 15, 2009 Posted January 15, 2009 Hi, thanks for response.Let's say I've got a file called myfile with 1 line written in it:c:\windowsIs there any way of calling dos cd comman and pass that line from the file so result would becd c:\windows?Thanks for your helpFor /F %%A in (myfile.txt) DO cd %%AThough it would be easier to write the whole line:cd c:\windowsto a file, give it the .bat or .cmd extension and START it.jaclaz
wally Posted January 15, 2009 Author Posted January 15, 2009 Hey thanks for reply, I tried below:C:\>type h:\filec:\windowsC:\>For /F %%A in (h:\file) DO cd %%A%%A was unexpected at this time. no joy... Can you help please?
wally Posted January 15, 2009 Author Posted January 15, 2009 FOR /F %i in (file) do cd %i worked!cheers
jaclaz Posted January 15, 2009 Posted January 15, 2009 Yes, you use single percentage sign % in command prompt and double %% in batches, I assumed you would have scripted it. jaclaz
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now