i try to launch a BAT file on a network share but i get this error:
\'\\\\dev\\applets\'
CMD.EXE was started with the above path as the current directory.
UN
If you want to go without drive-mapping you can use registry hack from Microsoft KB.
Do you have a chance to mount the network share first?
net use \\dev\applets z:
z:\mybatchfile.bat
I had the same problem.. while the script runs just fine, the CMD.EXE header was annoying.
To supress that text, I simply call a CLS as a first line of my script.
This will remove that nasty CMD.EXE header and display whatever you want afterwards.
Hope this helps.
You can create a Mapped Network Drive. Assuming you are on Windows XP, the process is:
In a Windows Explorer window,
Tools
Map Network Drive
X:
and \\dev\applets
)Finish
You can now just type
x:
cd applets
in your command prompt and run your batch file.
ALTERNATIVELY
You can also use the NET USE command to map the network drive. e.g.
NET USE X: \\dev\applets
x:
You can test ERRORLEVEL to see if the command completed successfully. Thanks to this brilliant bit of code, I can suggest this solution:
@echo off
set alpha=zyxwvutsrqponmlkjihg
SET completed=false
FOR /L %%i in (1,1,23) DO CALL :MAPDRIVE
:MAPDRIVE
set drive=%alpha:~0,1%
set alpha=%alpha:~1,23%
IF NOT %completed%==true (
ECHO Attempting to mount drive as %drive%
NET USE %drive%: \\dev\applets
)
IF %ERRORLEVEL% EQU 0 SET completed=true
GOTO END
:END
You can get the command-line processor to automatically map your UNC path to a drive when the batch script starts:
pushd %~dp0
echo %CD%
popd
When the popd command executes, or when your script ends, the drive will be automatically unmapped.
The only downside to this is that you still get the error message when the script runs.