1

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?

Ricardo Polo Jaramillo
  • 2,039
  • 1
  • 18
  • 35
BioLounge
  • 115
  • 1
  • 1
  • 6

2 Answers2

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.

Evan Anderson
  • 141,071
  • 19
  • 191
  • 328
2

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.

James Sneeringer
  • 6,755
  • 23
  • 27