1 2 Previous Next 17 Replies Latest reply on Nov 9, 2017 12:20 PM by Toby Erkson

    Tabcmd

    John Olcott

      Using tabcmd to automate download of view documents. Using a batch file I need to include the password. Tried different ways of encrypting password but tabcmd won't accept the password. Found an article on this but the script won't work for me.

      This is what's not working for me which was published in the article

       

      SETLOCAL ENABLEEXTENSIONS

       

      set mypath="C:\temp\Get_EncryptedPassword.ps1"

       

      set encrypted=" C:\temp\encrypt_pass_me.txt"

       

       

      for /f "delims=" %%a in ('powershell . %mypath% %encrypted% ') do set pass_word=%%a

       

      I get missing '(' in for command

       

       

       

       

       

        • 1. Re: Tabcmd
          Toby Erkson

          I recommend using a capital 'f' in your FOR statement:

          for /F "delims=" %%a in ('powershell . %mypath% %encrypted% ') do set pass_word=%%a
          

          Also, since there are no spaces in your file paths you can remove the quotes around them:

          set mypath=C:\temp\Get_EncryptedPassword.ps1
          set encrypted=C:\temp\encrypt_pass_me.txt
          

           

          Maybe it was a transcription mistake but there is a space following the first quote in your SET encrypted string

          Fixed:

          SETLOCAL ENABLEEXTENSIONS 
          set mypath=C:\temp\Get_EncryptedPassword.ps1
          set encrypted=C:\temp\encrypt_pass_me.txt
          for /F "delims=" %%a in ('powershell . %mypath% %encrypted% ') do set pass_word=%%a 
          
          • 2. Re: Tabcmd
            John Olcott

            Thanks for the reply. I tried F but it didn’t work. It keeps saying there’s a missing opening (

            I tried using no quotes in my set statements also.

            • 3. Re: Tabcmd
              Jeff Strauss

              try putting () around the do command.

               

              for /F "delims=" %%a in ('powershell . %mypath% %encrypted% ') do (set pass_word=%%a)

              • 4. Re: Tabcmd
                John Olcott

                Thanks for the suggestion. This is what I get.

                 

                 

                • 5. Re: Tabcmd
                  Toby Erkson

                  Shouldn't this be run in the command prompt, not in Powershell?

                  • 6. Re: Tabcmd
                    John Olcott

                    I was looking at the document and it said either. I’ll try it in cmd prompt. Thanks

                     

                     

                     

                    • 7. Re: Tabcmd
                      Toby Erkson

                      What document?  Please provide the URL to it.  Details, we can never have enough of them.

                      • 8. Re: Tabcmd
                        Jeff Strauss

                        good point about running within cmd and not powershell.  And change the for line to look like this:

                         

                        FOR /F "delims=" %%a in ('powershell . %mypath% %encrypted% ') do (set pass_word=%%a)

                        • 9. Re: Tabcmd
                          John Olcott

                          Found it online with your name on it as a matter of fact. Here it is. Thanks for looking.

                          • 10. Re: Tabcmd
                            John Olcott

                            Got a different error running it in cmd prompt.

                             

                            C:\Users\administrator.BAC>SET LOCAL ENABLEEXTENSIONS

                            LOCALAPPDATA=C:\Users\administrator.BAC\AppData\Local

                             

                            C:\Users\administrator.BAC>set mypath=c:\users\administrator.BAC\get_encrypyedpa

                            ssword.ps1

                             

                            C:\Users\administrator.BAC>set encrypted=c:\users\administrator.BAC\password.txt

                             

                             

                            C:\Users\administrator.BAC>FOR  /F "delims=" %%a in ('powershell . %mypath% %enc

                            rypted%') do (set pass_word=%%a)

                            %%a was unexpected at this time.

                             

                            C:\Users\administrator.BAC>FOR  /F "delims=" %%a in ('powershell . %mypath% %enc

                            rypted%') do set pass_word=%%a

                            %%a was unexpected at this time.

                             

                            C:\Users\administrator.BAC>FOR  /F "delims=" %%a in ('powershell . %mypath% %enc

                            rypted%') do (set pass_word=%%a)

                            %%a was unexpected at this time.

                             

                            C:\Users\administrator.BAC>

                            • 11. Re: Tabcmd
                              Jeff Strauss

                              cmd prompt is kind of finnicky.  If you run it interactive, then the variables need to be single %.  If you run the commands through a cmd script (i.e. trythis.cmd), then the variables need to be %% like what is above.  So try saving it as a .cmd file and then execute this .cmd file from the prompt and then let's see what you get.

                              • 12. Re: Tabcmd
                                Toby Erkson

                                Exactly where?  I've got a lot "out there" and I can see this needs updating.

                                 

                                The commands are for cmd.exe (a.k.a. DOS) batch script.  Powershell is only for the password un/encryption.  I need to make this more clear because I thought it was obvious but your questions show that it's not.

                                • 13. Re: Tabcmd
                                  Toby Erkson

                                  Yes, you cannot run this individually, line-by-line, from the cmd.exe prompt!  It needs to be a batch script.

                                  • 14. Re: Tabcmd
                                    John Olcott

                                    Ran it in batch from cmd prompt. Thanks

                                     

                                    C:\Users\administrator.BAC>SET LOCAL ENABLEEXTENSIONS

                                    LOCALAPPDATA=C:\Users\administrator.BAC\AppData\Local

                                     

                                    C:\Users\administrator.BAC>set mypath="c:\users\administrator.BAC\get_encrypyedp

                                    assword.ps1"

                                     

                                    C:\Users\administrator.BAC>set encrypted="c:\users\administrator.BAC\password.tx

                                    t"

                                     

                                    C:\Users\administrator.BAC>FOR /F "delims=" %a in ('powershell . "c:\users\admin

                                    istrator.BAC\get_encrypyedpassword.ps1" "c:\users\administrator.BAC\password.txt

                                    "') do set pass_word=%a

                                     

                                    C:\Users\administrator.BAC>set pass_word=. : The term 'c:\users\administrator.BA

                                    C\get_encrypyedpassword.ps1' is not

                                     

                                    C:\Users\administrator.BAC>set pass_word=recognized as the name of a cmdlet, fun

                                    ction, script file, or operable

                                     

                                    C:\Users\administrator.BAC>set pass_word=program. Check the spelling of the name

                                    , or if a path was included, verify

                                     

                                    C:\Users\administrator.BAC>set pass_word=that the path is correct and try again.

                                     

                                     

                                    C:\Users\administrator.BAC>set pass_word=At line:1 char:3

                                     

                                    C:\Users\administrator.BAC>set pass_word=+ . c:\users\administrator.BAC\get_encr

                                    ypyedpassword.ps1

                                     

                                    C:\Users\administrator.BAC>set pass_word=c:\users\administrator.BA ...

                                     

                                    C:\Users\administrator.BAC>set pass_word=+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                                    ~~~~~~~~~~~~~~~~~

                                     

                                    C:\Users\administrator.BAC>set pass_word=    + CategoryInfo          : ObjectNot

                                    Found: (c:\users\admini...yedpassword.p

                                     

                                    C:\Users\administrator.BAC>set pass_word=   s1:String) [], CommandNotFoundExcept

                                    ion

                                     

                                    C:\Users\administrator.BAC>set pass_word=    + FullyQualifiedErrorId : CommandNo

                                    tFoundException

                                     

                                    C:\Users\administrator.BAC>set pass_word=

                                    1 2 Previous Next