Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

For example:

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

Is there any way to do achieve this?

share|improve this question

2 Answers 2

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

 
discard

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.