1.

Solve : C# and batch files?

Answer»

I have a batch file that when a file is dragged and dropped on to it, it creates a txt file that has the location of the file that was dragged on to it. Afterwards, the batch file is suppose to run a c# console application, which is suppose to, well, do its own thing. But, instead the console application opens up as if I were to go to cmd (command prompt) starting at the location of "E:\documents and settings\jim\" where I can proceed to type "dir" and see all files and so on. The c# console application works fine if i just double click on it normally though. Any ideas thanks?
Perhaps if we could see a listing of the batch file? Then it wouldn't be guesswork.

by listing, you do mean, seeing the code in the batch file? Its quite simple actually, but if it helps, here it is.


Code: [Select]echo %1
echo %1>"c:/Program Files/HtmlLinker/address.txt"
start "HtmlLinker.exe"
exit
I made a batch file like yours and dropped a file on it, it did what you described.

You may have a drag-and-drop failure. This may be caused by a worm. The Blaster worm can do this. I suggest you give your system a THOROUGH virus check.

Do other drag and drop operations work OK?



Quote from: Dias de verano on March 24, 2008, 12:47:51 PM

I made a batch file like yours and dropped a file on it, it did what you described when the batch worked properly.

You may have a drag-and-drop failure. This may be caused by a worm. The Blaster worm can do this. I suggest you give your system a thorough virus check.

Do other drag and drop operations work OK?

If not, you may want to try these steps...

1]Sometimes just a system reboot solves the issue.So try that first.

2]Check whether Drag and Drop is enabled or not.Right click on Start button>Properties>Start Menu>Customize>Advanced>Under the start menu items make SURE the box against Enable dragging and dropping is checked.

3]If the above fails then try a System Restore.

4]If nothing helps,then type the following commands from the Run menu.:-

i>Start>Run>type in-"regsvr32 ole32.dll "(without the quotes)>press the Enter Key or OK.

ii>Start>Run>type in-"regsvr32 /i shell32.dll "(without quotes)>press the Enter
Key,or,OK.

5]RESTART the computer.

well, thanks for the suggestion but, none of those have helped and I have 4 antivirus/spyware/worms scanners that I run daily, and 2 firewalls, and a realtime scanner. Any more ideas? If it comes down to it, I might just make the program into a visual C# program.After a while of PLAYING around with the batch file, I decided to pause it at the end rather than exit. I found that it was printing the :

Code: [Select]Start "HtmlLinker.exe"

with exactly that....quotations and all. So I removed the quotations from it and found that I needed to create a path to it so this is what I came up with, and now my console program runs correctly.


Code: [Select]echo %1
echo %1>"c:/Program Files/HtmlLinker/address.txt"
Path=c:\Program Files\HtmlLinker;%PATH%
DOSKEY /insert
START HtmlLinker.exe
exit


Discussion

No Comment Found