Answer the question
In order to leave comments, you need to log in
Where is the error in the script for copying a folder, depending on the bitness of the OS?
Good time!
The situation is as follows: it is necessary that the script, after its launch, copies a certain folder from the network path to the computer where it was launched.
Copying should take place in different directories, depending on the bit depth of the OS.
I didn’t come across writing scripts so often, that’s why the question arose. I posted my version, but unfortunately it doesn't work. The script can be used both in BAT and VBS, the main thing is that the essence of copying is unchanged.
@echo on
set old_dir="\\ws-it-18\etc\LibreOffice\extensions\"
set x64="C:\Program Files (x86)\LibreOffice 5\share\extensions\"
set x86="C:\Program Files\LibreOffice 5\share\extensions\"
set "osX=%PROCESSOR_ARCHITECTURE%"
if defined PROCESSOR_ARCHITEW6432 set "osX=AMD64"
if "%osX%"=="x86" (
xcopy %old_dir% %x86%
) else (
xcopy %old_dir% %x64%
)
exit /b
Answer the question
In order to leave comments, you need to log in
What if so?
@echo on
set old_dir="\\ws-it-18\etc\LibreOffice\extensions\"
set x64="C:\Program Files (x86)\LibreOffice 5\share\extensions\"
set x86="C:\Program Files\LibreOffice 5\share\extensions\"
IF %PROCESSOR_ARCHITECTURE% == x86 (
IF %PROCESSOR_ARCHITEW6432% NOT DEFINED (
xcopy %old_dir% %x86%
) else (
xcopy %old_dir% %x64%
))
exit /b
I have
IF %PROCESSOR_ARCHITECTURE% == AMD64 (
echo AMD_64
) else (
echo OTHER
))
If Powershell is suitable, then you can
switch ((Get-WmiObject Win32_Processor).DataWidth)
{
64 {$DPath = "C:\Program Files (x86)\..."}
32 {$DPath = "C:\Program Files \..."}
}
instead of ellipsis further your paths. The DPath variable stores your full path.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question