I'm trying to run a batch file via the Scripting module that copies and overwrites a file.  The line I'm using is...

start /wait xcopy \\server2\public\av\SignageServerSettings.xml %fwi%\SignageSettings\ /y

If I just run the batch file on the workstation, it works fine.  But when I try to push it out via the KBox, it doesn't recognize the %fwi% variable and just copies to the root of the C:\ drive.

Any ideas?



Answer Summary:
0 Comments   [ - ] Hide Comments


Please log in to comment

Community Chosen Answer



I am using an Online Shell Script and I tried selecting "Run as Local System" and "Run as User logged in to console" which did not work.  Finally I ran it and provided the Domain admin credentials.  This seemed to work.  I also had to enclose the source and destination paths in " " incase there were any spaces in the path.

Answered 08/08/2012 by: bruno71
Senior Yellow Belt

  • Glad it works, go for it! Mark the question as answered and put in the solution so you get the Ninja points
  • paste the above to the answer summary for points also
Please log in to comment
Answer this question or Comment on this question for clarity



Dump the batch file and use robocopy.exe in your script



Answered 08/08/2012 by: SMal.tmcc
Red Belt

  • Just saw your answer here. I'll try this if my fix doesn't work. Thanks.
  • Robocopy does not seem to exist on Windows XP. The workstations I'm doing this on are a mix of XP and 7.
  • Sorry for that oversite when I replied. No it is not by default but you can download and add it, (pain for this one)
Please log in to comment

Forgive my ignorance, but is %fwi% actually an environment variable? I've never seen it before and it doesn't show up on the lists I generally use for reference.

Answered 08/08/2012 by: Ben M
Ninth Degree Black Belt

Please log in to comment

It's an environment variable created by a third-party program we use.  It exists and works in Windows Explorer or by manually running the batch file.  But when I try to push the same batch file out via KBox, it does not seem to recognize it.


%fwi% points to "C:\Documents & Settings\All Users\Documents\Four Winds Interactive\"

But when I push out the batch file with KBox, instead of the xcopy destination being...

"C:\Documents & Settings\All Users\Documents\Four Winds Interactive\SignageSettings\" 

...it copies the file to "\SignageSetings\" and it ends up creating a folder at "C:\SignageSettings\"


Answered 08/08/2012 by: bruno71
Senior Yellow Belt

  • I'd be curious if %fwi% works as System instead of a user. Try running the batch using PsExec: http://www.kace.com/support/resources/kb/article/how-to-mimic-running-a-script-as-local-system-user-scripting

    If not, use an online script and use a different account.
Please log in to comment