Here is some good explanations and background: 
https://social.technet.microsoft.com/Forums/systemcenter/en-US/0e8bca94-c2fb-46cc-b6c0-f3151382779d/working-directory-for-sccm-tasks.

Particularly Jason’s comments:
The reason the variable %~dp0 is needed as pointed out by Torsten is because 
the command shell (and thus batch files) cannot use UNCs for working 
directories.
If you change to download and execute, the problem goes away because the batch 
file runs from the local file system. For for simple batch files, you may not 
want to do this though.

Basically if you put your install string in your command line (not in a 
.bat/.cmd) or call it from PowerShell, you don’t need %~dp0.

Daniel Ratliff

From: [email protected] [mailto:[email protected]] On 
Behalf Of ccollins9
Sent: Wednesday, November 04, 2015 3:35 PM
To: mssms
Subject: Re: [mssms] Installing MSI and MSP a same time

Chris,  I was typing this from memory, so wasn't sure if if I used %~ or ~% in 
production, but I will revisit that.

Daniel, I usually do use quotes, was just typing this really quick from memory. 
But why do you say to only use %~dp0 in a batch? Will it flat not work as a 
single command line the deployment type?  I use batch where I have to, but 
usually only when I must, was seeing if it was avoidable in this scenario.

Thanks guys!



On Wed, Nov 4, 2015 at 3:19 PM, Chris Carbone 
<[email protected]<mailto:[email protected]>> 
wrote:
I would think your second attempt should work but noticed you have one part of 
the command backwards.

msiexec.exe /i appname.msi PATCH=%~dp0patch.msp /q


From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]<mailto:[email protected]>] 
On Behalf Of ccollins9
Sent: Wednesday, November 04, 2015 2:04 PM
To: mssms
Subject: [mssms] Installing MSI and MSP a same time

Anyone have experience doing this with SCCM 2012?  I'm not trying to use a 
patch file on this, but will if I need to.  Example command line: msiexec.exe 
/i appname.msi PATCH=patch.msp /q. Apparently the PATCH= needs a full path. How 
can I identify the temp path that the file will run from c:\windows\ccmcache\x?

I've tried:

msiexec.exe /i appname.msi PATCH=.\patch.msp /q

and

msiexec.exe /i appname.msi PATCH=~%dp0patch.msp /q


None seem to be working. Any help would be appreciated.  Thanks!

This electronic mail transmission may contain confidential information intended 
only for the use of the individual(s) identified as addressee(s). If you are 
not the intended recipient, you are hereby notified that any disclosure, 
copying, distribution or the taking of any action in reliance on the contents 
of this electronic mail transmission is strictly prohibited. If you have 
received this transmission in error, please notify me by telephone immediately.




The information transmitted is intended only for the person or entity to which 
it is addressed
and may contain CONFIDENTIAL material.  If you receive this 
material/information in error,
please contact the sender and delete or destroy the material/information.

Reply via email to