Matt Posted June 22, 2006 Report Share Posted June 22, 2006 Batch.Can anyone explain to my why this doesnt work? if not exist %windir%\system32\process.exe copy process.exe %windir%\system32\ Thanks so much!Matt Quote Link to post Share on other sites
jcl Posted June 22, 2006 Report Share Posted June 22, 2006 Seems to work here. Quote Link to post Share on other sites
Matt Posted June 22, 2006 Author Report Share Posted June 22, 2006 Doh! Ifigured it out. I wasn't in the same directory as process.exe when I was telling it to be copied. Therefor, it couldn't find the file Quote Link to post Share on other sites
Matt Posted June 26, 2006 Author Report Share Posted June 26, 2006 ok.. why does this tell me the syntax is incorrect?copy c:\test.txt %userprofile%\desktop\Matt Quote Link to post Share on other sites
shanenin Posted June 26, 2006 Report Share Posted June 26, 2006 I am not getting that error When I use that syntax. I do think that you do need to use quotestry these two examplesdir %userprofile%\desktopand thisdir "%userprofile%\desktop" Quote Link to post Share on other sites
Matt Posted June 26, 2006 Author Report Share Posted June 26, 2006 Thanks shane, the quotes did it! Quote Link to post Share on other sites
shanenin Posted June 26, 2006 Report Share Posted June 26, 2006 because %userprofile% expands to "C:\documents and settings\owner" (it may have a different user name). because of the spaces in "documents and settings" you need to enclose it in quotes Quote Link to post Share on other sites
shanenin Posted June 26, 2006 Report Share Posted June 26, 2006 (edited) think of it this way. the copy command needs two arguments. The first one is the file you are going to copy, the second is the destination to copy it two. CMD.exe splits the arguments up with spaces. So it is kind of like this, you used 4 argumentscopy(command) test.txt(first argument) C:\documents(second argument) and(third argument) settings\desktop(fourth argument)by using quotes you have just two argumentscopy(command) test.txt(first argument) "C:\documents and settings\desktop"(second argument) Edited June 26, 2006 by shanenin Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.