Question

i need to create a file as if i was the browser for a qa test. I figure if i copy and rename cmd.exe i can execute commands and the process will be the browser and complete my criteria for the test. i need to do this via a batch script. Below is my attempt at getting something to run as if it was from the browser.

my issue is the command is not creating the file in the directory like it should be. The dir command shows the directory as being empty even though as far as i can tell, everything worked correctly. There are no error logs or alerts. why can i not copy this file?

thanks!

copy C:\Windows\System32\cmd.exe %userprofile%\AppData\Roaming\firefox.exe
md %userprofile%\AppData\Local\test12
start %userprofile%\AppData\Roaming\firefox.exe \C copy C:\Windows\System32\cmd.exe %userprofile%\AppData\Local\test12\Test12.exe
dir %userprofile%\AppData\Local\test12\
Was it helpful?

Solution

If you try to use /K in stead of \C (the slash is wrong here) the cmd.exe (firefox.exe) will show you any errors that occured :

This works fine here:

start /WAIT %userprofile%\AppData\Roaming\firefox.exe /K copy C:\Windows\System32\cmd.exe %userprofile%\AppData\Local\test12\Test12.exe
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top