0

I try to do a batch file to use subst function.

Right now, I'm using paste in the modify menu of cmd.exe to add the string that I want to use.

I found that command :

powershell -sta "add-type -as System.Windows.Forms; [windows.forms.clipboard]::GetText()"

That shows my string ex.:

c:\user\ca\desktop\abb\cde

Now what I want to do is to use the subst function to get a new letter for that directory, lets say z:

so I was doing

subst z: c:\user\ca\desktop\abb\cde

How can I use the result of powershell to be in a variable that I can use with subst?

Ex :

Subst z: %PowershellResult%

What I want to do exactly is a batch file which creates a virtual drive but that I'm able to copy the path in the explorer and it will create the virtual drive without need to type the path in cmd.exe or click on the corner of the window, modify and paste.

Compo
  • 36,585
  • 5
  • 27
  • 39
  • check https://stackoverflow.com/a/6362922/4291215 – loadingnow Nov 15 '17 at 03:56
  • Do you need to run it from the cmd prompt or can you run it from the powershell prompt? – cup Nov 15 '17 at 09:40
  • I don't know the difference. What the best ? I can show you my script. The best will be to have a little exe file (that the antivirus don't see like one) that I can run directly in Windows but I'm not a Windows programmer. – Chuck Ghaudu Foché Nov 15 '17 at 10:54

0 Answers0