in reply to Re^3: VSS automation strange problem
in thread VSS automation strange problem

When I run this from Komodo
#!/usr/bin/perl -w use strict; use Win32; my $user = Win32::LoginName(); print "$user\n\n"; my $tasklist = `tasklist /v`; print $tasklist; chdir('C:\Program Files (x86)\Microsoft Visual SourceSafe'); $ENV{SSDIR} = 'C:\Program Files (x86)\Microsoft Visual SourceSafe'; my $env = `echo %SSDIR%`; print "\n$env\n"; my $result = `SS Dir \"$/\" -Yadmin`; print $result;
I get the one user (me) on the system, perl.exe has the same user, it echoes the correct SSDIR, then I get the error about the SSDIR variable not being set. When I run echo %USERDOMAIN%\%USERNAME% from the command window I get the same user as the script. Also when I drop the script into the VSS directory and run it from the command line I get the same result, running either in a plain command window or and administrator command window. So I guess it's not a Komodo issue.

How strange.

"I think computers have complicated lives very bigly. The whole age of, you know, computer has made it where nobody knows exactly what's going on." --D. Trump

Replies are listed 'Best First'.
Re^5: VSS automation strange problem
by Corion (Patriarch) on Jan 04, 2017 at 14:16 UTC

    Are you really, really sure that you want to run the following command:

    `SS Dir \"$/\" -Yadmin`

    Printing out the string that Perl (and the shell) would try to run shows me:

    SS Dir " " -Yadmin

    ... which most likely is not what you intended it to be. At least, I am unaware of Windows programs that handle newlines in their argument line well, if the shell even passes them through.

    What did you expect "$/" to do?

      Good catch Corion! In my suggestion on the original thread I had escaped the dollar sign so that "$/" would be passed to ss.exe. VSS commands use $/ as the root project path.

      my $cmd = "\"$sspath\\ss.exe\" Checkin \"\$/DMS MW/SCADA/Substation E +ditor F +iles/$filename\" -C\"$comment\" -I- -GL\"$checkout_path \"";

      This is likely to solve the user issues in the OP since as you pointed out the newline puts the -Yadmin option on a different command line in the command session.