2

Hello I'm trying to figure out on how to Run a file from network, basically it's located from \10.18.xx.xx\installers\install.bat, so yeah It's gonna prompt a username and password when I locate it manually.

What are the codes the I should use in bat file to run the install.bat from specific shared folder by determining on which version of MS outlook the computer has. example: MS Outlook is 32bit version then it's gonna run the install.bat from 32bit folder, and for MS Outlook 64bit version then it's gonna run the install.bat from 64bit folder. TIA!

Sorry for stupid question, I'm new in batch commands.. Computers are using MS Outlook 2013. Anyway I tried to make this and run this bat file from desktop and it closes immediately after running it like nothing happened.

CheckOS
IF EXIST "%PROGRAMFILES(X86)%" (GOTO 64BIT) ELSE (GOTO 32BIT)


:64BIT
\\10.18.xx.xx\Shared_Installers\PhishingOutlookPluginPH\64bit\install.bat -u 
myuser -p mypass
GOTO END



:32BIT
\\10.18.xx.xx\Shared_Installers\PhishingOutlookPluginPH\32bit\install.bat -u 
myuser -p mypass
GOTO END


:END
2
  • What have you tried thus far? What worked? What didn't work as expected? Look, we want to help you, but this isn't a code-writing service. We expect that, before getting help here, that you show us what you've tried and give evidence that you've tried to solve the problem on your own.
    – EEAA
    Jul 19, 2017 at 2:51
  • @EEAA Hello sorry for not indicating it before, I edited now my post, thank you
    – BRond
    Jul 19, 2017 at 3:02

1 Answer 1

3

While debugging batch scripts, don't just launch them by clicking the icon, but from the command line (cmd.exe). Otherwise, you won't get to see the error messages. Now, for the actual problems...

  1. There could have been this error:

    UNC path are not supported. Defaulting to Windows directory.
    

    You can't refer to the share with an UNC path in .bat batch script. Options:

    • Rename you script as .cmd to enable UNC support.

    • Use pushd (and popd) to temporarily map a network drive, e.g.:

      pushd \\10.18.xx.xx\Shared_Installers\PhishingOutlookPluginPH\64bit\
      install.bat -u
      popd
      
  2. You can't enter username and password from a new line in the script! Options:

    • Map a network drive with net use and give the credentials as parameters. However, you won't have the advances of using pushd or UNC anymore, and you'll end up revealing the password in your script.

    • There's nothing secret on a share only containing software updates. (I believe your Shared_Installers is a share like that). Simply add read permissions to everyone and the problem is solved.

  3. Just a hint... With IF EXIST "%PROGRAMFILES(X86)%" you only check if the OS is 64bit. That can't tell you whether the Office installation is 64bit, too. In your environment that may always be true, but can't be generalized. Also, sometimes it's better to use x86 Office even on x64 OS.

    You could use the value of Bitness at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\XX.0\Outlook (the XX being the Office version) to determine the installed version. It should be easy to script if everyone has the same main version, and possible even if they don't.

3
  • Thanks for this, anyway is there any possible way to determine on which bit version of MS Outlook that a computer has? I tried some of them but didn't work as expected.
    – BRond
    Jul 20, 2017 at 3:10
  • I added one option. Also, you could look for paths that only exists if x86 is installed. Jul 20, 2017 at 3:35
  • Okay very helpful information, thanks! I'll try to figure it all out.
    – BRond
    Jul 20, 2017 at 4:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .