/build/static/layout/Breadcrumb_cap_w.png

Copying a file using directory variables %folder%

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?

Thanks.

 


0 Comments   [ + ] Show comments

Answers (4)

Answer Summary:
Posted by: bruno71 11 years ago
Senior Yellow Belt
3

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.


Comments:
  • Glad it works, go for it! Mark the question as answered and put in the solution so you get the Ninja points - SMal.tmcc 11 years ago
  • paste the above to the answer summary for points also - SMal.tmcc 11 years ago
Posted by: SMal.tmcc 11 years ago
Red Belt
2

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

http://technet.microsoft.com/en-us/library/cc733145(v=ws.10).aspx

 


Comments:
  • Just saw your answer here. I'll try this if my fix doesn't work. Thanks. - bruno71 11 years ago
  • Robocopy does not seem to exist on Windows XP. The workstations I'm doing this on are a mix of XP and 7. - bruno71 11 years ago
  • Sorry for that oversite when I replied. No it is not by default but you can download and add it, (pain for this one)
    http://theos.in/windows-server/free-download-windows-xp-2003-robocopy-software/ - SMal.tmcc 11 years ago
Posted by: Ben M 11 years ago
9th Degree Black Belt
1

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.

Posted by: bruno71 11 years ago
Senior Yellow Belt
1

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.

Example:  

%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\"

 


Comments:
  • 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. - jknox 11 years ago

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ