drive

Identify CD drive and eject using bat or vbs while in WinPE without external files

淺唱寂寞╮ 提交于 2019-12-11 05:09:07
问题 I need to identify the CD drive and eject the tray. This is executed while booted in WinPE, so the WMP eject function is not available. This script will be used on various computer models/configurations. I'm currently using this: For Each d in CreateObject("Scripting.FileSystemObject").Drives CreateObject("Shell.Application").Namespace(17).ParseName("D:\").InvokeVerb("Eject") Next It works, but sometimes it errors and requires user interaction before it ejects. I suspect that it's because of

Detecting if path is on a windows mapped network drive

余生颓废 提交于 2019-12-10 16:05:39
问题 Is there a simple way to tell if a given path lives on a mapped network drive? Or to tell if a given drive is a mapped network drive? I hoped they would have a reparse point attribute but GetFileAttributes() returns nothing but a directory flag. 回答1: GetDriveType is one option. 回答2: Did you try GetFileAttributesEx() with GetFileExMaxInfoLevel ? 来源: https://stackoverflow.com/questions/3517175/detecting-if-path-is-on-a-windows-mapped-network-drive

Set Drive VolumeLabel

好久不见. 提交于 2019-12-10 13:18:37
问题 I am working on a small utility where I would like to change the volume label on flash drives that are connected to the computer. I know that DriveInfo is capable of doing it but I am at a loss as for how to accomplish it. If anyone has a code sample I would really appreciate it. Here is what i currently have: DriveInfo[] allDrives = DriveInfo.GetDrives(); foreach (DriveInfo d in allDrives) { if (d.IsReady && d.DriveType == DriveType.Removable) { //set volume label here } } 回答1: Thanks James!

Copying files over network MUCH slower with `file.copy` than `system(mv …)`

前提是你 提交于 2019-12-08 17:08:01
问题 I have been having some issues with R becoming very sluggish when accessing files over our corp network. So I dropped back and did some testing and I was shocked to discover that the R file.copy() command is MUCH slower than the equivalent file copy using system(mv ...) . Is this a known issue or am I doing something wrong here? Here's my test: I have 3 files: large_random.txt - ~100MB medium_random.txt - ~10MB small_random.txt - ~1 MB I created these on my Mac like so: dd if=/dev/urandom of

Java: how to determine the type of drive a file is located on?

丶灬走出姿态 提交于 2019-12-08 15:49:57
问题 Is there a platform-independent way with Java to detect the type of drive a file is located on? Basically I'm interested to distinguish between: hard disks , removable drives (like USB sticks) and network shares . JNI/JNA solutions won't be helpful. Java 7 can be assumed. 回答1: You could execute cmd using Java with: fsutil fsinfo drivetype {drive letter} The result will give you something like this: C: - Fixed Drive D: - CD-ROM Drive E: - Removable Drive P: - Remote/Network Drive 回答2: The

How to have the drive letter, with the device ID on Windows7

假如想象 提交于 2019-12-08 12:37:26
问题 I am a beginner in programming, so don't be rude ^^.. I'm developing a programme which will use to manage mass storage device. On Windows Xp and Windows 7. I' have already done the XP's manager. And for it, i used this function : Drive Letter to Device Instance ID I've try to understand what's this function was doing.. But in vain.. As i told you, i m a beginner, and i did'nt found one single tutorial about it. So, here's my problem : I've used this function for Windows XP as you can see :

Google's File Insert v2 API fails to recognise MIME TYPE application/vnd.google-apps.document

青春壹個敷衍的年華 提交于 2019-12-07 14:24:28
问题 This morning, I tried using Google APIs File Insert where I provided MIME TYPE as application/vnd.google-apps.document. I am getting the following response from Google API HttpError: <HttpError 400 when requesting https://www.googleapis.com/upload/drive/v2/files?uploadType=resumable&alt=json returned "Invalid mime type provided"> I replaced MIME TYPE application/vnd.google-apps.document with application/msword and the API started working. Has anything changed with Google API? 回答1: Google

How to get file physical location on hard drive

笑着哭i 提交于 2019-12-07 12:12:30
问题 I want to make a file shedder to completely delete a file, by writing zeros to its physical areas. Files may be stored on hard drive in pieces, not always in a whole block. When I say physical areas. I mean the physical sections that the file is stored, or any reference to those sections that I can perform "writing zeros". Better in C#. 回答1: Unfortunately, that is not entirely possible in C# and neither in C/C++ for that matter even if you are writing a kernel mode driver. Quote from the

Find file's parent id : Google Drive API V3

孤人 提交于 2019-12-07 03:26:42
问题 Today after I updated my Drive API to V3, I dint find any method to find the parent of the selected file . Is the rest endpoint to fetch json related to parent's info changed? 回答1: If you have the file id of the file in question then Files: get you need to add fields ie parents along with the file id. Request GET https://www.googleapis.com/drive/v3/files/0B5pJkOVaKccENWNNcFFaU2lSM0E?fields=parents&key={YOUR_API_KEY} Returns { "parents": [ "0B5pJkOVaKccEYW5lVHBKd1Zwc28" ] } The result is

List of file in a folder/ DRIVE API PyDRIVE

淺唱寂寞╮ 提交于 2019-12-07 01:06:12
问题 I can't change folder and view what's inside. drive = GoogleDrive(gauth) file_list = drive.ListFile({'q': "'root' in parents and trashed=false"}).GetList() for file1 in file_list: print("File %s\n\n",(file1)) I used the following code: file_list = drive.ListFile({'q': "'/test1' in parents and trashed=false"}).GetList() but it doesn't work. There's the documentation of the functions I used: https://developers.google.com/drive/v3/reference/files/list 回答1: You have to insert the folder ID