Solved

script needed

Posted on 2013-11-26
8
340 Views
Last Modified: 2013-11-28
Hi Experts,

I need a script to copy two files from a share to my clients.
The files needed to be copied to the programfiles folder.
Before the copy, the script has to check if its a x86 or x64 system.

Any ideas ?
0
Comment
Question by:Eprs_Admin
8 Comments
 
LVL 34

Expert Comment

by:Dan Craciun
ID: 39677897
Check if the folder Program Files (x86) exists.
If it does, copy the x64 version, if not, go for the x86 one

HTH,
Dan
0
 

Author Comment

by:Eprs_Admin
ID: 39678095
I need a script for it.
The script should check it like:

wmic os get architecture

and the result should of it should decide to install into folder x64 or x86.

How to do this via batch script
0
 
LVL 34

Assisted Solution

by:Dan Craciun
Dan Craciun earned 200 total points
ID: 39678145
$serverPath = "\\path\to\server"
$localPath = "X:\local\path"

if ((Get-WmiObject Win32_OperatingSystem).OSArchitecture -eq "64-bit") {
  Copy-Item $serverPath -Destination $localPath"\x64\"
}
else Copy-Item $serverPath -Destination $localPath"\x86\"


Not tested, but should get you started.
0
 

Author Comment

by:Eprs_Admin
ID: 39678179
I have seen, this is powershell.
How to do this in DOS as batch file?
Because the clients don´t have PS installed
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 34

Accepted Solution

by:
Dan Craciun earned 200 total points
ID: 39678213
What OS are your clients on? Powershell is installed on Windows 7 by default.
0
 
LVL 14

Assisted Solution

by:ThomasMcA2
ThomasMcA2 earned 100 total points
ID: 39678456
Try this:

@echo off

set serverPath = "\\path\to\server"

if exist "C:\Program Files (x86)" (
   set localPath = "C:\Program Files (x86)"
) else (
   set localPath = "C:\Program Files"
)

copy %serverPath% %localPath%

Open in new window

0
 
LVL 51

Assisted Solution

by:Bill Prew
Bill Prew earned 100 total points
ID: 39678457
Give this BAT a try, updating the files to copy.

@echo off

for /f "skip=2 tokens=2 delims=," %%A in ('wmic os get osarchitecture^,version /format:csv') do (
  if "%%A" EQU "64-bit" (
    set DestDir=C:\Program Files (x86)
  ) else (
    set DestDir=C:\Program Files
  )
)

copy "\\server\share\file1.txt" "%DestDir%"
copy "\\server\share\file2.txt" "%DestDir%"

Open in new window

~bp
0
 
LVL 43

Assisted Solution

by:Steve Knight
Steve Knight earned 100 total points
ID: 39678801
BTW is this a domain environment, have you tried out group policy preferences, you can easily target x64 and x86 differently and push down files,registry, apps etc....  

Steve
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now