Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: C# and batch files  (Read 5424 times)

0 Members and 1 Guest are viewing this topic.

zaryk

  • Guest
C# and batch files
« on: March 24, 2008, 07:40:23 AM »
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?

Dias de verano

  • Guest
Re: C# and batch files
« Reply #1 on: March 24, 2008, 09:34:44 AM »
Perhaps if we could see a listing of the batch file? Then it wouldn't be guesswork.  ::)


zaryk

  • Guest
Re: C# and batch files
« Reply #2 on: March 24, 2008, 11:15:47 AM »
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

Dias de verano

  • Guest
Re: C# and batch files
« Reply #3 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.

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?




Dias de verano

  • Guest
Re: C# and batch files
« Reply #4 on: March 24, 2008, 01:02:53 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.


zaryk

  • Guest
Re: C# and batch files
« Reply #5 on: March 24, 2008, 04:46:52 PM »
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.

zaryk

  • Guest
Re: C# and batch files
« Reply #6 on: March 24, 2008, 05:34:15 PM »
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
« Last Edit: March 25, 2008, 03:37:03 PM by zaryk »