Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to pass a shell variable called $test to windows from linux via winexe.

For example:

winexe -W WORKGROUP -U user%password // 'cmd.exe /C move D:\restore_db\$test D:\Restore\'

Is there any way to do achieve this?

share|improve this question

I've never used winexe before, but I don't see why you can't do shell variable substitution in the command line for winexe on the *nix side. I think you just need to tweak the shell variable substitution to do what you want and you're set. Double-quotes around your Windows command line containing the $ variable substitution ought to do the trick.

share|improve this answer

Since winexe is invoked on Linux, all the usual expansion rules apply. In your example, $test will not be expanded because you've enclosed it in single quotes. The literal text $test will be passed to cmd.exe. If you change the single quotes to double quotes, then $test will be expanded prior to it being passed to cmd.exe.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.