No announcement yet.

%SysDir%\cmd.exe with arguments.........please example or explain

  • Filter
  • Time
  • Show
Clear All
new posts

  • %SysDir%\cmd.exe with arguments.........please example or explain

    Hi, This is my first post so please bear with a noob.

    I am trying to simply create a virtual drive "w:" and map it to my directory "diskw". I am just using the same code I use in a .bat that works as a .bat, but fails in Media Studio.

    my code looks like this:
    File.Execute (%SysDir%\cmd.exe", "subst w: "diskw"", Wait)

    when i run the code, it opens cmd.exe, but only displays the path to the current directory; it does not create the virtual drive.

    here is the same code in my .bat file that works:

    @echo off
    subst w: "diskw"
    w:\usr\local\apache2\bin\Apache.exe -f w:\usr\local\apache2\conf\httpd.conf -d w:\usr\local\apache2\.
    subst w: /d

    Also, can I set the 'working directory' to point to w:\diskw? and then not have to create the virtual dir?


  • #2
    Re: %SysDir%\cmd.exe with arguments.........please example or explain

    Don't know if this will help but without dusting off my MSDOS manual to figure out what your doing or why you want to do it ... why don't you just File Execute the batch file?

    The part of my brain that used to know all those DOS commands was put to sleep a long time ago ...


    • #3
      Re: %SysDir%\cmd.exe with arguments.........please example or explain

      for one, "subst" is an .exe so you can't use the cmd to use it . Rather do file.execute %SysDir%\subst.exe then parameters. I cant be sure what the rest of the batch file is doing. I imagine once the drive has been mounted, you are then accessing files from within.

      As in batch files, when transfering commands to AMS, each line in the batchfile must have it's own command/function line in AMS.
      I think I would do
      file.execute %SysDir%\subst.exe
      parameters c:\diskw
      //Providing you know the drive Letter will be W:
      (maybe need to add the "application Sleep" function to give the Drive time to mount)

      file.execute w:\usr\local\apache2\bin\Apache.exe
      parameters -f w:\usr\local\apache2\conf\httpd.conf -d w:\usr\local\apache2\.

      //why you would use this in the same batch..I dunno since it removes the mounted drive? but

      file.execute %SysDir%\subst.exe
      parameters w: /d


      • #4
        Re: %SysDir%\cmd.exe with arguments.........please example or explain

        Thanks fo rthat info Option_Explicit,
        I appreciate the time you take to explain. I did not know about the subst.exe.

        I tried your idea ; but cannot seem to get it right after several times of banging my head against this wall. Any chance you could knock up a small example for me?

        If you find the time, thanks very much.

        [email protected]


        • #5
          Re: %SysDir%\cmd.exe with arguments.........please example or explain

          I was playing around with this a wee bit and got together something that may be of help,
          Download at

          The codes not real pretty, (no comments etc.) but still functional
          I'm still haven't made "Worm" status yet
          Anyway theres 2 examples, one where you just have a set path as you do in the batchfile of yours and one where you can get a user to create the drive from folders of choice using a bunch of Variables.
          Hope this helps