#๐Ÿ”’ how do i run this cmd command?

103 messages ยท Page 1 of 1 (latest)

fickle aurora
#

how do i run this command
"apktool_2.11.1.jar" d -s -o love-decoded "love-11.5-android-embed.apk" using os.system()

shell vortexBOT
#

@fickle aurora

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

fickle aurora
#

iam getting string errors, iam new to python

weak cloud
#

You probably need to wrap it all in single-quotes

fickle aurora
#

because you need a string for the command

#

and how do i wrap apktool_2.11.1.jar in a string?

weak cloud
#

I'm confused by your question then

fickle aurora
weak cloud
#

Can your show your actual code that's causing the error?

#

and also show the error

fickle aurora
#

one sec

#
import os
os.system("'apktool_2.11.1.jar' d -s -o love-decoded 'love-11.5-android-embed.apk'")
#

iam getting this error

#

''apktool_2.11.1.jar'' is not recognized as an internal or external command,
operable program or batch file.

weak cloud
#

Oh then in that case, you're probably executing your python script in a different working directory than where you have the apktool jar file

fickle aurora
#

wait let me see

weak cloud
#

you can check what your working directory is using os.getcwd()

fickle aurora
#

?

#

i tried using cd

weak cloud
#

Well, the easiest way is to probably copy your python file to the same directory as your .jar file

#

Then execute it there

#

But you can also use os.chdir()

fickle aurora
weak cloud
#

it stands for change directory

fickle aurora
#

let me try

fickle aurora
#

do i print it?

#

@weak cloud sorry for pinging

weak cloud
#

print what?

fickle aurora
#

os.getcwd

weak cloud
#

You just call it, and it'll change the current working directory

fickle aurora
#

to what?

weak cloud
#

To what your specify

fickle aurora
#

or both are the same

weak cloud
#

Yes

#

Oh

#

print(os.getcwd())

fickle aurora
#

it says iam on the folder that have the jar file

#

but its still showing the error

weak cloud
#

oh, in that case try adding ./ to the front of 'apktool_2.11.1.jar'

weak cloud
#

so like

os.system('"./apktool_2.11.1.jar" d -s -o love-decoded "love-11.5-android-embed.apk"')

or so

fickle aurora
#

oh

weak cloud
#

wrong spot

fickle aurora
#

its now saying

#

'.' is not recognized as an internal or external command,
operable program or batch file.

weak cloud
#

Hmm, one sec

#

oh, it's might have to be .\apktool etc

fickle aurora
#

its now saying this

weak cloud
#

Oh right, you need two .\\

#

Because one is used for things like \n or \t

#

So two means "ignore one"

fickle aurora
#

its saying this

#

'.\apktool_2.11.1.jar" d -s -o love-decoded "love-11.5-android-embed.apk' is not recognized as an internal or external command,
operable program or batch file.

weak cloud
#

You seem to have mismatched ' or "

fickle aurora
#

i did try to put .\ before the love one

weak cloud
#

double check those

fickle aurora
weak cloud
#
os.system('".\\apktool_2.11.1.jar" d -s -o love-decoded "love-11.5-android-embed.apk"')
#

No, you do

fickle aurora
#

thats what my code currently looks like

#
os.system('".\\apktool_2.11.1.jar" d -s -o love-decoded "love-11.5-android-embed.apk"')
weak cloud
#

I know

fickle aurora
#

wait is it the right one

#

what do i do then?

weak cloud
#

The error message you posted shows it starting with a single quote

fickle aurora
#

no

weak cloud
#

but you might not even need the quotes

#

have you tried

os.system('.\\apktool_2.11.1.jar d -s -o love-decoded love-11.5-android-embed.apk')
#

?

fickle aurora
weak cloud
#

Give that a shot, I don't think you need the quotes

#

but also, you needn't be doing this in Python

fickle aurora
#

one sec

weak cloud
#

you could just be doing it on the command line directly

fickle aurora
fickle aurora
#

thats why

weak cloud
#

But what's Python specific about this? You could just use a batch file and enter commands directly

weak cloud
#

Yeah but the command in that string there is a batch command

#

So adding Python (so far) is just adding an extra un-used layer of complexity.

fickle aurora
#

then how do i make it as a batch file

weak cloud
#

Save .\apktool_2.11.1.jar d -s -o love-decoded love-11.5-android-embed.apk to a text file, then change the file extension from .txt to .bat

fickle aurora
#

thats it?

weak cloud
#

Yup

fickle aurora
#

oh it actually works lol

weak cloud
#

lol

fickle aurora
#

ok thanks

#

!close

shell vortexBOT
#
Python help channel closed with !close

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.