cparker Posted March 29, 2005 Posted March 29, 2005 HiQuick question, is it possible to run dos commands from within WPI.For example mkdir, I get an error message that it cant find the file.Any ideas how to fix this? I dont really want to create cmd files to do the same thing.Thanks
Stalkie Posted March 29, 2005 Posted March 29, 2005 Most DOS functions isn't programs in 2k/XP, but only functions of CMD.At the end of generate.js in your WPI/wpiscripts folder is a function called substituteCommand where those commands can be replaces.About the makedir, I've changed the function a bit to this:function substituteCommand(cmd){ var prog = path(cmd); var firstToken = prog.substr(0,prog.indexOf(" ")); switch (firstToken.toUpperCase()) { case 'FILECOPY': prog = ("CMD /C " + prog.replace(/FILECOPY/gi,'copy')); break; case 'DIRCOPY': prog = ("CMD /C " + prog.replace(/DIRCOPY/gi,'xcopy') + "/I /E /Y"); break; case 'RENAME': prog = ("CMD /C " + prog.replace(/RENAME/gi,'ren')); break; // Additions by carsten@indysign.dk case 'DELETE': prog = ("CMD /C "+ prog.replace(/DELETE/gi, 'del') +" /q"); break; case 'MAKEDIR': prog = ("CMD /C "+ prog.replace(/MAKEDIR/gi, 'mkdir')); break; } return prog; }
Stalkie Posted March 31, 2005 Posted March 31, 2005 i just have wpi call a batch file.<{POST_SNAPBACK}>You could do that, but with many DOS-calls you quickly clutter your CD.I belive the inline way is more clean, but to each his own :-)
Swimming_Bird Posted March 31, 2005 Posted March 31, 2005 i definatley know what you mean but i only have to call 2 so its not a big pain for me.
Doc Symbiosis Posted June 4, 2005 Posted June 4, 2005 @Stalkie: Thanks for the post.I was searching a long time for a solution to the problem of running commands directly in WPI.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now