Is there any way to create a boot-able USB from a windows DVD via command line?
It is accepted using third party application which accepts command line arguments.
I searched internet but did not found any way.
You can do this using the program diskpart which is included in windows.
You need the following steps:
SELECT DISK <DRIVE NUMBER>
CLEAN
CREATE PARTITION PRIMARY
SELECT PARTITION 1
ACTIVE
FORMAT FS=NTFS QUICK
ASSIGN
EXIT
save them in a txt file. Find out the drive number using "LIST DISK"
You can then call diskpart with the /s parameter and give the saved textfile as a script.
Afterwards you can copy the content of the dvd over.
Now as to really do this programmatically:
The main difficulty would be selecting the correct drive number in case it may vary.
The main problem however is that this is a pretty dangerous operation. If you select the wrong disk (as stated those drives are selected by number not even by their drive letter) instead of your usb drive you might format a partition of your harddrive. I would personally not really fully automate the task but rather do it by hand.
Related
I have the following problem: We send customers a USB-stick with content that they need to import onto a Linux-computer via a import-function (no influence on the Linux-part, only on the USB-stick part). The Linux import-function cannot read files with spaces, i.e. the file "system volume information" which is created on every drive of a Windows computer disrupts the import function.
With a google research I found out, how I can delete this file on the drive of the USB-Stick. If I do that before disconnecting the USB-stick from my Windows computer, I can import the content on the Linux computer. I do this with a batch-file containing the following command:
rd /s /q D:\"system volume information"
However, those USB-Sticks are sent out to customers that will want to view the content on a Windows-computer as well, before importing it, i.e. the file "system volume information" is created anew. I would like to make it as simple as possible for the customer and put a batch-file on the stick where they simply have to double-click on it in order to delete the file. This is where my problem lies: I cannot be sure, that it will be drive D: where the stick will lie. This is why I am looking for a function or command that reads the drive of the batch-file (USB-Stick) and does the command of delete "system volume information". I read some things about %~d0 but I could not find out how I specifically have to write the command to make it work.
Would you be able to help me? I have very limited experience with batches, so I apologize if this question seems very easy for you.
Thanks
Milak
I have not tested the code:
#echo off
set P=%~d0
set "P=%P%\system volume information"
rd /s /q "%P%"
I am searching for a little batch or vbs script that does the following:
Find the drives in a list of valid drive letters, e.g. ['c','d','e','f'], that have a specific drive name, e.g. 'BackupDrive'
Remove the drive letters of the found drives so that they are no more displayed in Windows Explorer
Any suggestion is very appreciated.
You can do this using the command line tool "diskpart". As stated in the official technet documentation if you know the volume name you can remove it with:
select volume <volume number>
remove letter=<Letter>
You can automate this either using a script file (as documented here) with the exact commands, or by calling the exe with objShell.Exec on the shell object in vbscript and manipulating the stdin and stdout accordingly. An example for that can be found here. In your case this would probably be the better approach because you could do a "list volume" there and then parse the result for description and label and act accordingly. Afaik this is sadly the only way to get to the volume number, because it is not present in wmi or somewhere easier queryable.
Please keep in mind that diskpart is a VERY powerful tool, that can wipe whole partitions, so use it with caution.
Also note:
You cannot remove the drive letters on system, boot, or paging
volumes. In addition, you cannot remove the drive letter for an OEM
partition, any GPT partition with an unrecognized GUID, or any of the
special, non-data, GPT partitions such as the EFI system partition.
As it appears there is no version of DOS (6.22 to WinME "DOS") or FreeDOS that allows you to take part of a text file and make it a variable, I'm going to just keep collecting the data I get in DOS mode into one very large file but I can't think of a way to get each asset and UUID and add them together in a third file... Here is what I get at the moment:
SMBIOS.TXT
~~~~~~~(usually 27 lines of stuff I don't need)~~~~~~~
Asset Number: ABC12345
~~~~~~~(usually 37 lines of stuff I don't need)~~~~~~~
UUID: ABCDEF12345678901234567890
~~~~~~~(usually 4 lines of stuff I don't need, complicated by a # symbol in there too)~~~~~~~
^Repeated many times
I need to add both the Asset Number and the UUID together in a CSV format so I was previously hoping (before I exhausted all attempts at doing for /F in DOS) just echoing the two variables I was creating as follows:
ECHO !Asset!,!UUID!>>Results.CSV
Which again works in Windows command prompt just not DOS, the script I'm using however only gets the first variable of each so I need to do them in order and keep repeating through the file in the manner?
Alternatively is there any other way I could use DOS to get the info I need out of the two text files on the fly? It's all running from a USB stick so I don't have any size constraints at least.
Aaron
You may be able to get it done with the DOS command line text stream editor EDLIN.
I am assuming this has to be done in DOS and Windows is not an option.
PDGREPPE is an MS DOS command line GREP search and replace utility.
Maybe you can find a DOS Text Editor with Macros
Lotus 123?
DBase?
Write an app in DOS BASIC.
I am trying to get a couple scripts to work with each other, but I am not entirely familiar with the if-then commands, I am using wizapp and I have my info ready to go, but I don't know how to map a specific location based on the output of wizapp, as a for instance
if %siteid%=="0"
How do I map that to a drive, I have 10 different drives that have to be mapped using that
info, and I am lost, siteid will obviously be different in each if then statement?
This is relatively easy to do. I will provide manual instructions as it is extremely useful to learn and will improve your coding skills.
C:\windows\system32> net view
Server Name Remark
---------------------------------------------------------------------------------
\\PC1
\\PC2
\\PC3
\\PC4
\\PC5
\\PC6
\\PC7
\\PC8
\\PC9
\\SERVER
The command completed successfully.
C:\windows\system32> net view \\PC1
Shared resources at \\PC1
Share name Type Used as Comment
-------------------------------------------------------------------------------
SharedDocs Disk
The command completed successfully.
C:\windows\system32> net use ( Drive letter A-Z ) \\PC1\SharedDocs
The command completed successfully.
Now open up My Computer and youll see that PC1 is registered as a drive onto your computer.
I know FAT32, as well as FAT16/12 neither support symbolic links nor hard-links. However I came up with this idea:
The FAT specification describes that every file is associated with a directory-entry. In my understanding, one could say that a file-entry in a directory somehow or other points to the file's content.
So, how can I define two directory-entries which point to the same file-content? Or, what could prevent me from doing so?
Use case: I have a USB mass storage device for my car radio, and I want to use directories as playlists since the radio software doesn't support playlists. So it isn't important to me how Windows behaves when doing this.
This should work for simple issues. I.e. it works as a hack / workaround and I don't know what happens if you rename / move / remove files. So, you should not do this on your main hdd.
I edited the directory-entries manually using a hex editor. I modified clusters as well as file-sizes and successfully faked hardlinks. My car-radio and even Windows (7, 64Bit) have no problems with playing back the original and "hard-linked" mp3-Files I used.
When I'm opening the device again in the hex-editor none of my modifications are changed back (See chkdsk issue in answer #1 - but as far as I know chkdsk has to be started manually, anyways.
What you are talking about ("two directory-entries which are pointing to the same file-content") are hard links. chkdsk will report them as cross-links and break them, "repairing" the files (in fact making the copies).
MichaelPh posted instructions on SuperUser:
https://superuser.com/a/486829/51237
It's possible to use Disk Probe (on XP only, I've yet to get it to write the changes on Win7) to modify the cluster a FAT Directory references. This method can be used to redirect the DCIM folder (or a subfolder) to point to the folder used by a different scan device.
Whether this is a good idea or not is a different matter and you use this at your own risk.
Insert the Eye-Fi card either in it's USB Card Reader or directly into an SSD slot and note the drive letter it's installed as (assumed to be F:\ for simplicity)
Ensure all Windows Explorer windows for the card and sub-directories are closed.
Run Disk Probe
Select Drives->Logical Volume
In the Open Logical Volume dialog double-click F:\ in the Logical Volumes list
Click the Set Active button for the Handle F: has been selected as. You can leave the handle as read-only for now.
Select Tools->Search Sectors...
Check Exhaustive Search, enter DCIM in Enter characters to search for and Search
You should find a match (mine is at 8192). Select No on the "Found match..." dialog to cancel the rest of the search.
Select Sectors->Read and increase Number of Sectors to at least two so that the whole directory table is included.
Find DCIM in the ASCII on the right of the Disk Probe screen, this is the start of the FAT entry for the directory. Make a note of the hex value of the 27th byte of the record (each entry is 32bytes), this is the directory cluster reference. This value is require to revert the DCIM directory back to normal use if required.
Find the entry for the directory you want to redirect DCIM to and again make a note of the 27th byte in the record.
Go back to the 27th byte of the DCIM record and change it to the value noted in step 11.
Select Sectors->Write and then click Write it on the Write Sector dialog. A warning will come up if you opened the sectors as read-only. Yes to overwrite if you're happy to make the change.
Opening the DCIM directory in Windows Explorer will now show the contents of the target directory.