Passing parameter

Started by mtruong1, September 22, 2014, 07:59:33 AM

Previous topic - Next topic

mtruong1

In DOS, I can pass parameter as %username% onto a DOS script, for example

cd "d:\users\%username%\abc\def"

and the script would pass the actual username (ie, john, michael) as a replacement for %username% when it run.

In WinBatch, I run the following command

DirChange (d:\users\%username%\abc\def) and Winbatch would not recognize %username%

How can I resolve this issue??

thx

JTaylor

Take a look at the Environment() function.

Jim

td

Quote from: mtruong1 on September 22, 2014, 07:59:33 AM
In DOS, I can pass parameter as %username% onto a DOS script, for example

cd "d:\users\%username%\abc\def"

and the script would pass the actual username (ie, john, michael) as a replacement for %username% when it run.

In WinBatch, I run the following command

DirChange (d:\users\%username%\abc\def) and Winbatch would not recognize %username%

How can I resolve this issue??

thx

Code (winbatch) Select

username = Environment('username')
DirChange ('d:\users\%username%\abc\def')
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade