|
|
|||||||
The following dos commands work fine at the dos level and I have been trying to get them to work as a .kix file with no joy. I would appreciate any help or suggestions that will get me going. Thanks. shell "cmd.exe /C IF EXIST L:\NUL net use L: /DELETE" shell "cmd.exe /C net use L: \\server\share password /USER:user /PERSISTENT:Yes" shell "c:\"Program Files\SecCopy\SecCopy.exe" /RunAllProfiles /ExitWhenIdle" shell "c:\windows\system32\shutdown.exe -s -t 300 -c 'Daily shutdown. To abort, double-click the Abort Shutdown icon.' -f" |
||||||||
|
|
|||||||
try this Code: shell 'cmd.exe /C "IF EXIST L:\NUL net use L: /DELETE" shell 'cmd.exe /C "net use L: \\server\share password /USER:user /PERSISTENT:Yes"' shell '"c:\Program Files\SecCopy\SecCopy.exe" /RunAllProfiles /ExitWhenIdle' shell '"c:\windows\system32\shutdown.exe" -s -t 300 -c "Daily shutdown. To abort, double-click the Abort Shutdown icon. -f"' |
||||||||
|
|
|||||||
Welcome to KORG. First off, I'm not sure why you're simply using Kix to run DOS commands. Either use a single BAT file or convert the commands to Kix to improve performance. Secondly, using "cmd.exe" is bad form. The best way to launch the current interpreter is via "%COMSPEC%". Same deal for "Program Files" and the "Windows" directories - use the corresponding system variables %PROGRAMFILES% and %WINDIR% as these locations can vary between systems. Finally, it's a good habit to use single quotes for any Shell/Run commands because the DOS commands prefer or require double quotes. As Arend illustrated, you can embed double-quotes easily inside the single-quoted Kix strings. You can replace the first two lines with native Kix. Code: If Exist('L:\nul') Use L: /DELETE EndIf Use L: '\\SERVER\share' /user:USERID /password:password /PERSISTENT shell '"%PROGRAMFILES%\SecCopy\SecCopy.exe" /RunAllProfiles /ExitWhenIdle' shell '"%WINDIR%\system32\shutdown.exe" -s -t 300 -c "Daily shutdown. To abort, double-click the Abort Shutdown icon." -f' Glenn |
||||||||
|
|
|||||||
Just for old times sake I'm gonna play Devil's Advocate on Glenn again ;-) - I fixed his code so it can be learned how to properly use what he already wrote. - cmd.exe is actually not bad form as "cmd.exe" is always in the system32 folder, which is always in the %path% variable so it always gets resolved. However I do agree with Glenn on the %ProgramFiles% and %WinDir%/%SystemRoot% variables. - and last, Glenn always points you in the right direction, he just gives a LOT of directions at once ;-) |
||||||||
|
|
|||||||
Doesn't everyone have a GPS nowadays? |
||||||||
|
|
|||||||
Quote: - cmd.exe is actually not bad form as "cmd.exe" is always in the system32 folder, which is always in the %path% variable so it always gets resolved. Well, to up the Devil's Advocate stakes I also consider that it is bad form.
Ok, it's unlikely that anyone has ancient versions of Windows on the domain but suffice it to say you are safer with the environment variable than just closing your eyes, pulling the trigger and hoping that you hit the right one |
||||||||
|
|
|||||||
Originally Posted By: Richard Ok, it's unlikely that anyone has ancient versions of Windows on the domain but suffice it to say you are safer with the environment variable than just closing your eyes, pulling the trigger and hoping that you hit the right one Actually you are right on that. I agree and stand corrected On that note... have a nice weekend! |
||||||||
|
|
|||||||
You guys were a big help - thanks. I'm still having a problem with the USE command. I have: Use L: '\\SERVER\share' /user:'USERID' /password:'password' /PERSISTENT The password has an @ so I'm enclosing it in quotes. The user is straight text, but I'm enclosing it in quotes to try to solve the problem which is no matter what I do I get "unknown user or bad password". They really are the correct user and password. Any thoughts? Thanks again. |
||||||||
|
|
|||||||
Check the manual for information on "reserved" characters and escaping them.. Basically you want to @@ to make it work. |
||||||||
|
|
|||||||
You could do two things. -1 Use this at the top of your script: Code: $rc = Setoption("NoMarcosInStrings", "On") -2 Double the @ in the password. Kix will interpret this as a single @. The first option is the best practice scripting. |
||||||||
|
|
|||||||
Thanks!!! Everything is working smoothly. I really appreciate all the help. |