8

I have some virtual Windows-7 machines, referring to a D:-drive. This D:-drive seems to be configured as a drive mapping, as can be seen in the result of the subst command:

Prompt>subst
D:\: => C:\d_drive

I have a copy of this machine, where I'd like to map the same drive, but this seems not to work:

Prompt>subst D: C:\d_drive
Invalid parameter - D:

For your information:

  1. The command subst does not mention the D:-drive already being mapped.
  2. The command net use does not mention the D:-drive already being used.
  3. Configuration settings, Computer management, Disk management does not mention the D:-drive already existing.
  4. I don't see anything in the event viewer (or I'm looking at the wrong place).

What might be going wrong here? What might cause subst to refuse to map this D:-drive?

5
  • If you run wmic logicaldisk get name as the same user, i.e. same command prompt as the failing subst command, does D: appear? Commented Mar 3, 2017 at 13:39
  • Yes, indeed, D:-drive is one of the mentioned names. What does this mean?
    – Dominique
    Commented Mar 6, 2017 at 14:48
  • D:-drive seems to be the CD-ROM disk. As I'm working here with a virtual machine, I don't need this and I'd like to remove it, but the command wmic logicaldisk D: DELETE seems not to work (Provider is not capable of the attempted operation), even not when logged as administrator. What now?
    – Dominique
    Commented Mar 6, 2017 at 14:58
  • Could it be virtual? Maybe even a disk image file. I would check the CD-ROM settings for the VM. Commented Mar 6, 2017 at 18:36
  • Meanwhile I found the solution: using computer management, I modified the drive letter of the CD-ROM, and as a result, D:-drive became available for drive mapping. @EMK: your comment was the first step towards the final solution. Please rephrase it as an answer, so that I can accept it.
    – Dominique
    Commented Mar 7, 2017 at 8:03

5 Answers 5

8

If you get the following error message when running subst:

Invalid parameter

I would suggest initially checking if the drive you are referencing is already in use by the system. To check, in the same command prompt as the one you you are running subst run the command:

 wmic logicaldisk get name

The output of this will be something like:

Name    
C:
D:
E:

As an alternative to wmic.exe if no longer available, from a PowerShell prompt, run:

Get-CimInstance -class Win32_LogicalDisk | select name

Note: For a drive that is already created with subst you will get the error:

Drive already SUBSTed

1
  • 1
    HelpingHand indeed... completely forgot about the CD drive and wondered why D: could be a wrong parameter x)
    – Andreas
    Commented Jan 3, 2023 at 10:00
1

The short answer is D: already exists. Try something like subst C: F:\temo and you get the "Invalid Parameter - C:". Can't do it because it already exists and hence the error.

1

I also had this issue with a batch script which used the subst X: %CD% command. Turned out it was placed in a directory with a space in the name. Directory renamed, issue solved

1

I experienced a similar problem just now. I created a X: drive with subst X: <some_path> and afterwards tried to remove it with subst X: /d to no avail. Running the command in a terminal resulted in Invalid parameter - X: and the drive was still featured in File Explorer.

The root cause? I have cygwin installed and it turns out subst is also provided by cygwin. The feedback I was getting came from the cygwin subst which had no impact on the drive mapping.

The solution? I've launched a windows command line by running plain old cmd, and once I re-ran subst X: /d the drive was gone.

0

Try something like R instead of D. Maybe D is reserved for a CD drive.

C:\Users\user>subst R: c:\crp

^^^ that worked

C:\Users\user>d:
The device is not ready.

^^ looks like D is used already

C:\Users\harvey>j:
The system cannot find the drive specified.

^^^ that's the [normal] message when a drive letter isn't assigned 

C:\Users\user>subst D: c:\crp
Invalid parameter - D:

^^^ see I get the same error as you when I try it with D. Try it with R.

C:\Users\user>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .