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?
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?
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.
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
.