Passing %systemroot% in a command

R

Ray at

Hi group,

I'm trying to use soon.exe from the reskit to schedule a job on a remote
machine, and I want to specify the path to the executable to be in
%systemroot%. When I execute my command, my %systemroot% variable is
expanded, as I expected, but I have not been able to get around it.


(My %systemroot% is D:\Windows)

This command:
SOON %compName% %%systemroot%%\system32\rayrcmd.bat
Generates on remote machine:
D:\Windows\system32\rayrcmd.bat

------

This command:
SOON %compName% ^%systemroot^%\system32\rayrcmd.bat
Generates on remote machine:
\system32\rayrcmd.bat

------


Enclosing the command in " yields the same results. I thought that I could
escape % with a ^, but it doesn't seem to be working for me. Can anyone
tell me how I can pass the literal %systemroot% string and have my remote
task have %systemroot% instead of my interpreted systemroot?

Thank you,

Ray at work
 
R

Ray at

FWIW, I just deleted the reference to %systemroot%\system32 in the command,
and that works just fine since that path is in the %path% var on all
machines, but I'd still be curious to know how to pass a literal string
surrounded by %'s.

Thank you,

Ray at work
 
D

Dean Wells [MVP]

It would appear that the schedule service requires literals (at least to
some extent). I experienced the same behavior some time ago and resolved
it by using an alternative reference to SystemRoot -

soon \\odyssey \\localhost\admin$\rayrcmd.bat

Not a solution to your problem per se but a functioning workaround
nonetheless.

HTH

Dean
 
R

Ray at

That was how I originally had it (actually %compname%\system32, where
%compname% was from my net view batch), but I decided to be picky and change
it. But, at least I know that others experience it. Thanks a lot Dean!

Ray at work

Dean Wells said:
It would appear that the schedule service requires literals (at least to
some extent). I experienced the same behavior some time ago and resolved
it by using an alternative reference to SystemRoot -

soon \\odyssey \\localhost\admin$\rayrcmd.bat

Not a solution to your problem per se but a functioning workaround
nonetheless.

HTH

Dean

--
Dean Wells [MVP / Windows platform]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l


Ray at said:
Hi group,

I'm trying to use soon.exe from the reskit to schedule a job on a remote
machine, and I want to specify the path to the executable to be in
%systemroot%. When I execute my command, my %systemroot% variable is
expanded, as I expected, but I have not been able to get around it.


(My %systemroot% is D:\Windows)

This command:
SOON %compName% %%systemroot%%\system32\rayrcmd.bat
Generates on remote machine:
D:\Windows\system32\rayrcmd.bat

------

This command:
SOON %compName% ^%systemroot^%\system32\rayrcmd.bat
Generates on remote machine:
\system32\rayrcmd.bat

------


Enclosing the command in " yields the same results. I thought that I could
escape % with a ^, but it doesn't seem to be working for me. Can anyone
tell me how I can pass the literal %systemroot% string and have my remote
task have %systemroot% instead of my interpreted systemroot?

Thank you,

Ray at work
 
D

Dean Wells [MVP]

Found another way -

soon \\odyssey "cmd /c start ^%systemroot^%\system32\rayrcmd.bat"

This seems somewhat self defeating in that for CMD to execute
successfully it must already be using the path but ... :)

Downside - Using the start command removes the hook between the schedule
service and the actual command we're running but does prevent a long
term instance of CMD.

I guess, simply stated, we needed to find something that would expand
the variable on the remote machine.

HTH

Dean
 
D

Dean Wells [MVP]

Hmmm ... ignore that point regarding using the start command and long
term instance, that only applies to my scenario in which I'm remotely
scheduling binaries not shell scripts. In your case, it would seem to
make sense to remove it completely.

Focus Dean, focus :)

Dean

--
Dean Wells [MVP / Windows platform]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l


Dean Wells said:
Found another way -

soon \\odyssey "cmd /c start ^%systemroot^%\system32\rayrcmd.bat"

This seems somewhat self defeating in that for CMD to execute
successfully it must already be using the path but ... :)

Downside - Using the start command removes the hook between the schedule
service and the actual command we're running but does prevent a long
term instance of CMD.

I guess, simply stated, we needed to find something that would expand
the variable on the remote machine.

HTH

Dean

--
Dean Wells [MVP / Windows platform]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l


"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
Hi group,

I'm trying to use soon.exe from the reskit to schedule a job on a remote
machine, and I want to specify the path to the executable to be in
%systemroot%. When I execute my command, my %systemroot% variable is
expanded, as I expected, but I have not been able to get around it.


(My %systemroot% is D:\Windows)

This command:
SOON %compName% %%systemroot%%\system32\rayrcmd.bat
Generates on remote machine:
D:\Windows\system32\rayrcmd.bat

------

This command:
SOON %compName% ^%systemroot^%\system32\rayrcmd.bat
Generates on remote machine:
\system32\rayrcmd.bat
I
could
escape % with a ^, but it doesn't seem to be working for me. Can anyone
tell me how I can pass the literal %systemroot% string and have my remote
task have %systemroot% instead of my interpreted systemroot?

Thank you,

Ray at work
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top