E
eric.goforth
Hello,
I have a simple batch file that I'm trying to call from a VB.NET
application:
@ECHO OFF
IF (%1)==() GOTO END
DIR %1 > MYDIR.TXT
:END
@ECHO ON
In VB.NET I can call the batch file without the sMYDir parameter:
System.Diagnostics.Process.Start(AppDomain.CurrentDomain.BaseDirectory
& "saveMylist.bat ")
But when I add my parameter:
System.Diagnostics.Process.Start(AppDomain.CurrentDomain.BaseDirectory
& "saveMylist.bat " & sMYDir)
I get:
"The system cannot find the file specified"
Does anyone have an idea how to work around this? I don't want to hard
code the path in my batch file.
AppDomain.CurrentDomain.BaseDirectory is:
"C:\Documents and Settings\MyUser\My Documents\Visual Studio
2005\Projects\MyProj\bin\Debug\"
I had problems with spaces i the patch when I tried running the command
from a command prompt, so I tried changing the commandline to:
System.Diagnostics.Process.Start(ControlChars.Quote &
AppDomain.CurrentDomain.BaseDirectory & "saveMylist.bat" " &
ControlChars.Quote & " " & sMYDir)
and get the same error.
I CAN run the complete concatenated string returned by
(ControlChars.Quote & AppDomain.CurrentDomain.BaseDirectory &
"saveMylist.bat" " & ControlChars.Quote & " " & sMYDir) from the
command prompt with no errors, but it doesn't work when I call it from
System.Diagnostics.Process.Start.
Thanks,
Eric
I have a simple batch file that I'm trying to call from a VB.NET
application:
@ECHO OFF
IF (%1)==() GOTO END
DIR %1 > MYDIR.TXT
:END
@ECHO ON
In VB.NET I can call the batch file without the sMYDir parameter:
System.Diagnostics.Process.Start(AppDomain.CurrentDomain.BaseDirectory
& "saveMylist.bat ")
But when I add my parameter:
System.Diagnostics.Process.Start(AppDomain.CurrentDomain.BaseDirectory
& "saveMylist.bat " & sMYDir)
I get:
"The system cannot find the file specified"
Does anyone have an idea how to work around this? I don't want to hard
code the path in my batch file.
AppDomain.CurrentDomain.BaseDirectory is:
"C:\Documents and Settings\MyUser\My Documents\Visual Studio
2005\Projects\MyProj\bin\Debug\"
I had problems with spaces i the patch when I tried running the command
from a command prompt, so I tried changing the commandline to:
System.Diagnostics.Process.Start(ControlChars.Quote &
AppDomain.CurrentDomain.BaseDirectory & "saveMylist.bat" " &
ControlChars.Quote & " " & sMYDir)
and get the same error.
I CAN run the complete concatenated string returned by
(ControlChars.Quote & AppDomain.CurrentDomain.BaseDirectory &
"saveMylist.bat" " & ControlChars.Quote & " " & sMYDir) from the
command prompt with no errors, but it doesn't work when I call it from
System.Diagnostics.Process.Start.
Thanks,
Eric