我正在使用 Android 新照片选择器,我试图获取照片的真实文件位置,但照片选择器给了我以下内容URI content://media/picker/0/com.android.providers.media.photopicker/media/1000000020
我还尝试了以下方法来获取真实的文件位置,但是当我检查文件中的图像时,这似乎也给了我一个不准确的位置。
@Composable
private fun getRealPathFromURI(contentUri: Uri): String {
val projection = arrayOf(MediaStore.Images.Media.DATA)
val context = LocalContext.current
val cursor = context.contentResolver.query(contentUri, projection, null, null, null)
val columnIndex = cursor?.getColumnIndexOrThrow(MediaStore.Images.Media.DATA)
cursor?.moveToFirst()
val filePath = cursor?.getString(columnIndex!!)
cursor?.close()
println("filepath $filePath")
return filePath!!
}
Run Code Online (Sandbox Code Playgroud)
/sdcard/.transforms/synthetic/picker/0/com.android.providers.media.photopicker/media/1000000003.jpg
这不可能吗?
在远程计算机上工作时偶尔会出现此错误.在我使用哪台计算机时,它会受到影响.但我能够ping掉计算机和测试连接平台.例如,我今天得到这个错误的计算机我昨天能够到达.我知道计算机已启动,因为它就在我旁边.
Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:1 char:14
+ get-wmiObject <<<< -Class win32_operatingsystem -ComputerName $current -Authentication 6 -credential $credential | Invoke-WMIMethod -name Win32Shutdown
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], COMException
+ FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
Run Code Online (Sandbox Code Playgroud) 我需要创建一个安装文件,检查注册表中是否有其他软件的版本.目前我正在评论和取消评论单独的安装代码行.如何将以下内容变为有条件的?
<!--<Property Id="ACADREG" Value="ACAD-A001:409" /> Autocad 2012-->
<Property Id="ACADREG" Value="ACAD-A004:409" /> <!--Autocad Arch 2012-->
Run Code Online (Sandbox Code Playgroud)
我还需要获取安装后期版本.
<Property Id="ACADROAMDIR">
<RegistrySearch Id="ROAMROOTDIR" Root="HKCU" Type="raw" Key="Software\Autodesk\AutoCAD\[ACADVER]\[ACADREG]" Name="RoamableRootFolder" />
</Property>
<Property Id="ACADDIR">
<RegistrySearch Id="AcadLocRegistry" Type="raw" Root="HKLM" Key="SOFTWARE\Autodesk\AutoCAD\[ACADVER]\[ACADREG]" Name="AcadLocation" />
</Property>
Run Code Online (Sandbox Code Playgroud)
wiX有没有办法通过阅读注册表设置[ACADREG]而不是像我上面那样设置它?
我有一个脚本,我需要以管理员身份运行,就像我右键单击cmd.exe并单击以管理员身份运行一样.
目前这就是我所拥有的:
Call WSHShell.Run("cmd.exe /K netdom renamecomputer ... end code")
Run Code Online (Sandbox Code Playgroud) 如何重新启动脚本?我有3个开关,我希望它们恢复到脚本的开头.
Import-Module ActiveDirectory
Write-Host "--Please Login using a.account--"
#login
$credential = Get-Credential
#Main
Write-Host "--Remote Computer Rename v2.0--"
Write-Host "1. Query AD (Outputs to a text file)"
Write-Host "2. Quick computer rename"
Write-host "3. Quit"
$choice=Read-Host "Chose a number to continue"
#AD Query for computer
switch ($choice)
{
1 {
Write-Host "--Enter first five characters of computer name or full computer name i.e. USCLT--"
$cn=Read-Host 'Computer name'
$out="$cn*"
Get-ADComputer -Filter 'SamAccountName -like $out' >> c:\myscripts\dsquery.txt
Write-Host "Query complete. See dsquery.txt …Run Code Online (Sandbox Code Playgroud)