Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Passing variable to script from file using DOS

Featured Replies

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?

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.

  • Author

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

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

  • Author

Hey thanks for reply, I tried below:

C:\>type h:\file

c:\windows

C:\>For /F %%A in (h:\file) DO cd %%A

%%A was unexpected at this time.

:( no joy... Can you help please?

  • Author

FOR /F %i in (file) do cd %i

worked!

cheers :thumbup

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.