subst what?
-
I got a source code for an old application from the repository. The path to the projects in the solution file was set as absolute pointing to the D: drive. I have single disk and D: is used by the DVD. Changed DVD letter to E and created a virtual drive D: using subst
subst D: C:\
this worked like a charm, but it means I would have to subst the drive every time I boot the machine. So I created a batch file stuck it to the startup folder and called subst from the batch file. :) This was all good except I called my batch file subst.bat. Guess what happens when the batch file executes, Hmmm infinite loop calling it self. ;P/* I can C */ // or !C Yusuf
-
I got a source code for an old application from the repository. The path to the projects in the solution file was set as absolute pointing to the D: drive. I have single disk and D: is used by the DVD. Changed DVD letter to E and created a virtual drive D: using subst
subst D: C:\
this worked like a charm, but it means I would have to subst the drive every time I boot the machine. So I created a batch file stuck it to the startup folder and called subst from the batch file. :) This was all good except I called my batch file subst.bat. Guess what happens when the batch file executes, Hmmm infinite loop calling it self. ;P/* I can C */ // or !C Yusuf
-
I got a source code for an old application from the repository. The path to the projects in the solution file was set as absolute pointing to the D: drive. I have single disk and D: is used by the DVD. Changed DVD letter to E and created a virtual drive D: using subst
subst D: C:\
this worked like a charm, but it means I would have to subst the drive every time I boot the machine. So I created a batch file stuck it to the startup folder and called subst from the batch file. :) This was all good except I called my batch file subst.bat. Guess what happens when the batch file executes, Hmmm infinite loop calling it self. ;P/* I can C */ // or !C Yusuf
Wow, there's a blast from the past. I don't recall any problems having the subst command being run from a batch file though... A silly trick I used to play though used the subst program with the assign program was to create a substitute drive, assign the c: drive to be the logical equivalent of the substitute drive and the remove the substitute drive. This had the side effect of logically removing the c: drive as well, rendering the drive inaccessible until a reboot. Although it wasn't too bad if you wanted a rather crude form of "security" in the days of DOS... you could show only the parts of the disk you wanted to.
------------------------ Luke Lovegrove ------------------------
-
Wow, there's a blast from the past. I don't recall any problems having the subst command being run from a batch file though... A silly trick I used to play though used the subst program with the assign program was to create a substitute drive, assign the c: drive to be the logical equivalent of the substitute drive and the remove the substitute drive. This had the side effect of logically removing the c: drive as well, rendering the drive inaccessible until a reboot. Although it wasn't too bad if you wanted a rather crude form of "security" in the days of DOS... you could show only the parts of the disk you wanted to.
------------------------ Luke Lovegrove ------------------------
Luke Lovegrove wrote:
Wow, there's a blast from the past. I don't recall any problems having the subst command being run from a batch file though...
The problem was not with subst. I called my batch file subst.bat. inside the batch file I called subst. So, first it looks in the current working dir and it finds subst.bat and it called it, what follows is, you know ... :laugh: :laugh: :laugh:
/* I can C */ // or !C Yusuf
-
I got a source code for an old application from the repository. The path to the projects in the solution file was set as absolute pointing to the D: drive. I have single disk and D: is used by the DVD. Changed DVD letter to E and created a virtual drive D: using subst
subst D: C:\
this worked like a charm, but it means I would have to subst the drive every time I boot the machine. So I created a batch file stuck it to the startup folder and called subst from the batch file. :) This was all good except I called my batch file subst.bat. Guess what happens when the batch file executes, Hmmm infinite loop calling it self. ;P/* I can C */ // or !C Yusuf
Put the following line into a .bat file:
%0|%0
Do you know what that 5-byte .bat-file does? WARNING: YOU MAY LOOSE UNSAVED DATA IF YOU TRY TO RUN IT! If you really want to try it, use a virtual machine! Or if you are really evil: put it on a co-worker's desktop and wait to see if he is curious enough to run it. -
Put the following line into a .bat file:
%0|%0
Do you know what that 5-byte .bat-file does? WARNING: YOU MAY LOOSE UNSAVED DATA IF YOU TRY TO RUN IT! If you really want to try it, use a virtual machine! Or if you are really evil: put it on a co-worker's desktop and wait to see if he is curious enough to run it.Now I have to know. Do tell what it does... please? :-O
-Gatsby
-
Now I have to know. Do tell what it does... please? :-O
-Gatsby
%1, %2, ... are the arguments to the batch file. %0 is the name of the batch file itself (the command line used to start it). So the .bat file calls itself and pipes its output into another copy of itself. Piping works by running the processes in parallel, to pipe into a .bat file a new instance of cmd.exe is created. So the batch file starts two copies of itself in parallel => it's a fork bomb[^]
-
I got a source code for an old application from the repository. The path to the projects in the solution file was set as absolute pointing to the D: drive. I have single disk and D: is used by the DVD. Changed DVD letter to E and created a virtual drive D: using subst
subst D: C:\
this worked like a charm, but it means I would have to subst the drive every time I boot the machine. So I created a batch file stuck it to the startup folder and called subst from the batch file. :) This was all good except I called my batch file subst.bat. Guess what happens when the batch file executes, Hmmm infinite loop calling it self. ;P/* I can C */ // or !C Yusuf
Along the similar lines: I have a function that expands environmental variables. Thats being called by a number of programs. So for example, if I have MYROOT=C:\rootdir, then I might have a setting in my config file such as run %MYROOT%\myexec.exe My function would then translate to: run c:\rootdir\myexec.exe. So far so good. Somehow, I had variable that was set to MYVAR=%MYVAR% .... can you guess what happened when the code attempted expanding that (recursively) ?? :-\ Obviously, it was not as simple as MYVAR=%MYVAR%, it is just an example.
-
Put the following line into a .bat file:
%0|%0
Do you know what that 5-byte .bat-file does? WARNING: YOU MAY LOOSE UNSAVED DATA IF YOU TRY TO RUN IT! If you really want to try it, use a virtual machine! Or if you are really evil: put it on a co-worker's desktop and wait to see if he is curious enough to run it. -
Wow, there's a blast from the past. I don't recall any problems having the subst command being run from a batch file though... A silly trick I used to play though used the subst program with the assign program was to create a substitute drive, assign the c: drive to be the logical equivalent of the substitute drive and the remove the substitute drive. This had the side effect of logically removing the c: drive as well, rendering the drive inaccessible until a reboot. Although it wasn't too bad if you wanted a rather crude form of "security" in the days of DOS... you could show only the parts of the disk you wanted to.
------------------------ Luke Lovegrove ------------------------
Neat! chroot in DOS... and MS hasn't figured that out for their FTP server YET!
-- Peter