2

I have created a batch file that will run an installation through intune.

  1. it will install the application
  2. it will install the configuration file

And I need to add a 3rd step, which would then add a registry key once step 1 and 2 are completed.

Current batch file:

application.exe /quiet /norestart 
timeout /t 50 /nobreak
"C:\Program Files\Fortinet\FortiClient\config.exe" -m all -f ".\config.conf" -o import -i 1 -p XX

How do I go about adding the registry in same batch?

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Fortinet\FortiClient\FA_UI\VPN-7.2] "installed"=dword:651dce3a

DavidPostill
  • 162,382

3 Answers3

2

I finally disagree with the great @DavidPostill !! :^P

I suggest (if you are already in batch) using the reg command and not a .reg file as the legend himself suggests.

Something like:
reg add HKCU\SOFTWARE\SOFTWARE\Fortinet\FortiClient\FA_UI\VPN-7.2 /v installed /t REG_DWORD /d 651dce3a

Try reg /? from the command line to see the options.

0

How do I go about adding the registry in the same batch file?

Use regedit:

Import a reg script:

REGEDIT pathname

where pathname is the name of the file containing the instructions.

Example:

regedit myfile.reg

where myfile.reg contains:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Fortinet\FortiClient\FA_UI\VPN-7.2] "installed"=dword:651dce3a


Further Reading

DavidPostill
  • 162,382
0
Windows Registry Editor Version 5.00 ; & @cls & @cd /d "dp0" & @goto :install

[HKEY_CURRENT_USER\SOFTWARE\Fortinet\FortiClient\FA_UI\VPN-7.2]
"installed"=dword:651dce3a

;:install
;   @;( 
;      %ComSpec% /c "start "" /w "application.exe" /quiet /norestart"
;      %ComSpec% /c "start "" /w "C:\Program Files\Fortinet\FortiClient\config.exe" -m all -f ".\config.conf" -o import -i 1 -p XX"
;      "%__AppDir__%reg.exe" import "%~f0" 1>nul 2>&1
;    );= 

1. Use a hybrid with file;

2. Use cmd.exe "Start /Wait .." your installers/configurator;

3. Save the above code as some file Name.cmd and run...

P.S. Start /wait .. replaces your timeout 50 to a precise time

Io-oI
  • 9,237